Skip to content
Snippets Groups Projects
Unverified Commit 85bac300 authored by aeschylus's avatar aeschylus Committed by GitHub
Browse files

Merge pull request #1574 from ProjectMirador/test-componentPlugins

add tests for componentPlugins function
parents 03b96de9 4a62f6ed
Branches
Tags
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