flecks/packages/core/test/gather.js

27 lines
754 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
2024-01-16 00:28:20 -06:00
const testOne = require('./packages/one');
const testTwo = require('./packages/two');
2022-02-25 04:58:08 -06:00
2024-01-28 08:05:25 -06:00
it('can gather', async () => {
const flecks = await Flecks.from({
2022-02-25 04:58:08 -06:00
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
},
});
2024-01-29 08:15:22 -06:00
const Gathered = await 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
});