UNPKG

bonsai-analyzer

Version:
44 lines (40 loc) 1.11 kB
"use strict"; var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); var _defaults = require("../../__test_helpers__/defaults"); var _getEntryHierarchy = _interopRequireWildcard(require("../getEntryHierarchy")); const stats = { chunks: [(0, _defaults.defaultChunk)({ id: 0, names: ['chunk-zero'] }), (0, _defaults.defaultChunk)({ id: 1, names: ['chunk-one'], parents: [0] }), (0, _defaults.defaultChunk)({ id: 2, names: ['chunk-two'] })], modules: [] }; describe('getEntryHierarchy', () => { it('should list all the chunks', () => { const result = (0, _getEntryHierarchy.default)(stats); expect(result).toMatchSnapshot(); }); it('should flatten the list of all chunks', () => { const result = (0, _getEntryHierarchy.flattenChunksByParent)((0, _getEntryHierarchy.default)(stats).children); expect(result).toEqual([{ id: 0, name: 'chunk-zero', indent: 0 }, { id: 1, name: 'chunk-one', indent: 1 }, { id: 2, name: 'chunk-two', indent: 0 }]); }); });