Advertisement
Dolly2315

Untitled

Dec 3rd, 2018
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. Provider Side Data :
  2. {"name":"Demo Taxonomy","taxons":[{"id":8145188,"name":"manojtaxon","childCategoryName":"hello","hasChildren":true},{"id":8094058,"name":"taxnon4","hasChildren":false},{"id":8094014,"name":"taxon1","childCategoryName":"Taxon 1 Cat","hasChildren":true},{"id":8094016,"name":"taxon2","hasChildren":false},{"id":8094022,"name":"taxon3","hasChildren":false},{"id":8094024,"name":"taxon4","hasChildren":false},{"id":8094028,"name":"taxon5","hasChildren":false},{"id":8094030,"name":"taxon6","hasChildren":false},{"id":8094032,"name":"taxon7","hasChildren":false},{"id":8094036,"name":"taxon8","hasChildren":false},{"id":8094040,"name":"taxon9","hasChildren":false},{"id":8094050,"name":"taxonn1","hasChildren":false},{"id":8094052,"name":"taxonn2","hasChildren":false},{"id":8094054,"name":"taxonn3","childCategoryName":"list1","hasChildren":true}]}
  3.  
  4.  
  5.  
  6. Consumer side data :
  7.  
  8. const firstChild = {
  9. 'name': 'Geo',
  10. 'taxons': [
  11. {
  12. 'id': 115590,
  13. 'name': 'Africa',
  14. 'hasChildren': false
  15. },
  16. {
  17. 'id': 115586,
  18. 'name': 'America',
  19. 'hasChildren': false
  20. },
  21. {
  22. 'id': 115578,
  23. 'name': 'Asia',
  24. 'childCategoryName': 'Country',
  25. 'hasChildren': true
  26. },
  27. {
  28. 'id': 115582,
  29. 'name': 'Europe',
  30. 'hasChildren': false
  31. }
  32. ]
  33. };
  34.  
  35. So I am using matchers currently like this :
  36.  
  37. const firstChild = eachLike({
  38. 'name': like('Geo'),
  39. 'taxons': eachLike({
  40. 'id': 115590,
  41. 'name': 'Africa',
  42. 'hasChildren': false
  43. })
  44. })
  45.  
  46. But then not sure how to use it for array size more than 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement