mirror of
https://github.com/qlik-oss/nebula.js.git
synced 2025-12-19 17:58:43 -05:00
49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
// import generator from '../../src/generator';
|
|
|
|
describe('generator', () => {
|
|
const [{ default: generator }] = aw.mock(
|
|
[['**/creator.js', () => (...a) => [...a]], ['**/qae.js', () => qae => qae || 'qae']],
|
|
['../../src/generator']
|
|
);
|
|
|
|
it('should have a default qae property', () => {
|
|
expect(generator({}).qae).to.eql('qae');
|
|
});
|
|
|
|
it('should have a component property', () => {
|
|
expect(generator({}).component).to.eql({});
|
|
});
|
|
|
|
it('should not override reserved properties', () => {
|
|
expect(
|
|
generator({
|
|
foo: 'bar',
|
|
component: 'c',
|
|
}).definition
|
|
).to.eql({
|
|
foo: 'bar',
|
|
});
|
|
});
|
|
|
|
it('should accept a function', () => {
|
|
const spy = sinon.stub().returns({});
|
|
generator(spy, { translator: 't', Promise: 'P' });
|
|
expect(spy).to.have.been.calledWithExactly({
|
|
translator: 't',
|
|
Promise: 'P',
|
|
});
|
|
});
|
|
|
|
it('should create an instance', () => {
|
|
const g = generator(
|
|
{},
|
|
{
|
|
translator: 't',
|
|
Promise: 'P',
|
|
}
|
|
);
|
|
const ret = g.create('a');
|
|
expect(ret).to.eql([g, 'a', { translator: 't', Promise: 'P' }]);
|
|
});
|
|
});
|