mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
f08a55c21f
refs: https://github.com/TryGhost/Team/issues/856 refs: https://github.com/TryGhost/Team/issues/756 - The .test.js extension is better than _spec.js as it's more obvious that it's an extension - It also meaans we can use the --extension parameter in mocha, which should result in a better default behaviour for `yarn test` - It also highlights that some of our tests were named incorrectly and were not (and still will not be) run (see https://github.com/TryGhost/Team/issues/856) - Note: even with this change, `yarn test` is throwing errors, I believe because of this issue https://github.com/TryGhost/Team/issues/756
24 lines
952 B
JavaScript
24 lines
952 B
JavaScript
const should = require('should');
|
|
const optionsUtil = require('../../../../../core/server/api/shared/utils/options');
|
|
|
|
describe('Unit: api/shared/util/options', function () {
|
|
it('returns an array with empty string when no parameters are passed', function () {
|
|
optionsUtil.trimAndLowerCase().should.eql(['']);
|
|
});
|
|
|
|
it('returns single item array', function () {
|
|
optionsUtil.trimAndLowerCase('butter').should.eql(['butter']);
|
|
});
|
|
|
|
it('returns multiple items in array', function () {
|
|
optionsUtil.trimAndLowerCase('peanut, butter').should.eql(['peanut', 'butter']);
|
|
});
|
|
|
|
it('lowercases and trims items in the string', function () {
|
|
optionsUtil.trimAndLowerCase(' PeanUt, buTTer ').should.eql(['peanut', 'butter']);
|
|
});
|
|
|
|
it('accepts parameters in form of an array', function () {
|
|
optionsUtil.trimAndLowerCase([' PeanUt', ' buTTer ']).should.eql(['peanut', 'butter']);
|
|
});
|
|
});
|