(name, tree)
| 678 | } |
| 679 | |
| 680 | function assertTreeValidJSON(name, tree) { |
| 681 | let json = tree.toJSON(); |
| 682 | |
| 683 | expect(Object.keys(json)).to.eql(['nodes']); |
| 684 | expect(json.nodes.length).to.eql(8); |
| 685 | |
| 686 | expect(json.nodes.map((x) => x.id)).to.eql([1, 2, 3, 4, 5, 6, 7, 8]); |
| 687 | |
| 688 | expect(json.nodes.map((x) => x.label)).to.eql([ |
| 689 | { name, emberCLI: true }, |
| 690 | { name: 'a' }, |
| 691 | { name: 'b1', broccoliNode: true, broccoliCachedNode: false }, |
| 692 | { name: 'c1' }, |
| 693 | { name: 'b2' }, |
| 694 | { name: 'c2', broccoliNode: true, broccoliCachedNode: false }, |
| 695 | { name: 'd1', broccoliNode: true, broccoliCachedNode: true }, |
| 696 | { name: 'c3' }, |
| 697 | ]); |
| 698 | |
| 699 | expect(json.nodes.map((x) => x.children)).to.eql([[2], [3, 5], [4], [], [6, 8], [7], [], []]); |
| 700 | |
| 701 | let stats = json.nodes.map((x) => x.stats); |
| 702 | stats.forEach((nodeStats) => { |
| 703 | expect('own' in nodeStats).to.eql(true); |
| 704 | expect('time' in nodeStats).to.eql(true); |
| 705 | expect(nodeStats.time.self).to.be.within(0, 2000000); //2ms in nanoseconds |
| 706 | }); |
| 707 | |
| 708 | let c1Stats = stats[3]; |
| 709 | expect(c1Stats.mystats).to.eql({ |
| 710 | x: 3, |
| 711 | y: 4, |
| 712 | }); |
| 713 | } |
| 714 | |
| 715 | function assertTreeValidAPI(name, tree) { |
| 716 | let depthFirstNames = Array.from(tree.dfsIterator()).map((x) => x.label.name); |
no test coverage detected
searching dependent graphs…