flecks/packages/core/test/gather.js

27 lines
717 B
JavaScript
Raw Normal View History

2022-02-25 04:58:08 -06:00
import {expect} from 'chai';
2022-02-26 09:47:29 -06:00
import {Flecks, ById, ByType} from '@flecks/core';
2022-02-25 04:58:08 -06:00
2022-02-26 10:24:16 -06:00
const testOne = require('./one');
const testTwo = require('./two');
2022-02-25 04:58:08 -06:00
it('can gather', () => {
const flecks = new Flecks({
flecks: {
2022-02-26 10:24:16 -06:00
'@flecks/core/one': testOne,
'@flecks/core/two': testTwo,
2022-02-25 04:58:08 -06:00
},
});
2022-02-26 10:24:16 -06:00
const Gathered = flecks.gather('@flecks/core/one/test-gather');
2022-02-25 04:58:08 -06:00
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)
2022-03-11 05:50:59 -06:00
.to.not.be.undefined;
2022-02-25 04:58:08 -06:00
});