CopyPasteUtil.js 766 B

1234567891011121314151617181920212223242526272829
  1. import CopyPasteUtil from 'lib/util/CopyPasteUtil';
  2. describe('util/CopyPasteUtil', function() {
  3. describe('#getTopLevel', function() {
  4. var sA = { id: 'a', parent: { id: 'root' } },
  5. sB = { id: 'b', parent: sA },
  6. sC = { id: 'c', parent: sA },
  7. sE = { id: 'e', parent: sA },
  8. sD = { id: 'd', parent: { id: 'b' } },
  9. sF = { id: 'f', parent: { id: 'e' } },
  10. sG = { id: 'g', parent: { id: 'f' } },
  11. sX = { id: 'x', parent: { id: 'y' } };
  12. it('should only get the top level', function() {
  13. // when
  14. var topLevel = CopyPasteUtil.getTopLevel([ sA, sB, sC, sE, sD, sG, sF, sX ]);
  15. // then
  16. expect(topLevel).to.contain(sA, sX);
  17. expect(topLevel.length).to.equal(4);
  18. });
  19. });
  20. });