Skip to content

Commit

Permalink
test(pluginMetaName): add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiphe committed May 22, 2016
1 parent 6004544 commit 9c5a955
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/plugins/pluginMetaNameSpec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use strict';

const pluginMetaName = require('../../lib/plugins/pluginMetaName');
const errorMatching = require('../helper/errorMatching');

describe('pluginMetaName', () => {
describe('#validate', () => {
it('throws when there is no name on meta', () => {
expect(() => {
pluginMetaName.validate({ meta: {} });
}).toThrow(errorMatching('does not provide required "name" in it\'s meta data'));
});

it('does not throw when there is a name', () => {
expect(() => {
pluginMetaName.validate({ meta: { name: 'foo' } });
}).not.toThrow();
});
});

describe('#decorateTask', () => {
it('decorates the task with a displayName', () => {
const name = 'foo';
const task = pluginMetaName.decorateTask({ provider: { meta: { name } } });

expect(task.displayName).toBe(name);
});

it('strips "gulp-toolbox-" and converts dashes to colons', () => {
const name = 'gulp-toolbox-foo-bar';
const task = pluginMetaName.decorateTask({ provider: { meta: { name } } });

expect(task.displayName).toBe('foo:bar');
});
});
});

0 comments on commit 9c5a955

Please sign in to comment.