flecks/packages/core/test/gather.js
2022-02-26 09:47:29 -06:00

28 lines
789 B
JavaScript

import {expect} from 'chai';
// eslint-disable-next-line import/no-unresolved
import {Flecks, ById, ByType} from '@flecks/core';
const testFleckOne = require('./fleck-one');
const testFleckTwo = require('./fleck-two');
it('can gather', () => {
const flecks = new Flecks({
flecks: {
'./fleck-one': testFleckOne,
'./fleck-two': testFleckTwo,
},
});
const Gathered = flecks.gather('./fleck-one/test-gather');
expect(Object.keys(Gathered[ByType]).length)
.to.equal(Object.keys(Gathered[ById]).length);
const typeKeys = Object.keys(Gathered[ByType]);
for (let i = 0; i < typeKeys.length; ++i) {
const type = typeKeys[i];
expect(Gathered[type].foo)
.to.equal(type);
}
expect(typeof Gathered.Three.bar)
.to.not.equal('undefined');
});