Skip to content

Commit

Permalink
update plugin unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw committed Oct 8, 2018
1 parent 0904e4a commit 0deeecb
Showing 1 changed file with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,33 @@ describe('Plugin', () => {

describe('.configure(config, replace)', () => {
it('extends the default config with given config when replace is not set or false', () => {

const plugin = new Plugin();
plugin.configure({ key: 'abc', foo: 'bar' });
plugin.configure({ key: 'def' });
expect(plugin.config).to.deep.equal({ key: 'def', foo: 'bar' });
});
it('replaces the default config with given config when replace is true', () => {

const plugin = new Plugin();
plugin.configure({ key: 'abc', foo: 'bar' });
plugin.configure({ key: 'def' }, true);
expect(plugin.config).to.deep.equal({ key: 'def' });
});
it('returns the plugin itself', () => {

const plugin = new Plugin();
expect(plugin.configure({ key: 'abc' })).to.equal(plugin);
});
});

describe('.resetConfig()', () => {
it('resets config back to default', () => {

const plugin = new Plugin();
plugin.configure({ key: 'abc', foo: 'bar' });
plugin.resetConfig();
expect(plugin.config).to.deep.equal({});
});
it('returns the plugin itself', () => {

const plugin = new Plugin();
expect(plugin.resetConfig()).to.equal(plugin);
});
});
});

0 comments on commit 0deeecb

Please sign in to comment.