Skip to content
Snippets Groups Projects
Commit 4a62f6ed authored by Jack Reed's avatar Jack Reed
Browse files

add tests for componentPlugins

parent 863325d0
No related branches found
No related tags found
No related merge requests found
import componentPlugins from '../../../src/lib/componentPlugins';
describe('componentPlugins', () => {
const originalMirador = window.Mirador;
beforeAll(() => {
window.Mirador = {
plugins: {
fooPlugin: {
name: 'fooPlugin',
parent: 'FooComponent',
},
barPlugin: {
name: 'barPlugin',
parent: 'FooComponent',
},
},
};
});
afterAll(() => {
window.Mirador = originalMirador;
});
it('only selects plugins that are defined in config', () => {
expect(componentPlugins('FooComponent', ['barPlugin'])[0].name).toEqual('barPlugin');
expect(componentPlugins('FooComponent', ['barPlugin']).length).toEqual(1);
});
it('only selects plugins that define component as parent', () => {
expect(componentPlugins('BarComponent', ['barPlugin'])).toEqual([]);
expect(componentPlugins('FooComponent', ['fooPlugin']).length).toEqual(1);
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment