mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 10:53:34 +03:00
95d27e7f58
- this is a small part of a bit of cleanup of our test files - the goal is to make the existing tests clearer with a view to making it easier to write more tests - this makes the test structure follow the codebase structure more closely - eventually we will colocate the frontend tests with the frontend code
67 lines
1.6 KiB
JavaScript
67 lines
1.6 KiB
JavaScript
const should = require('should');
|
|
|
|
// Stuff we are testing
|
|
const plural = require('../../../../core/frontend/helpers/plural');
|
|
|
|
describe('{{plural}} helper', function () {
|
|
it('will show no-value string', function () {
|
|
const expected = 'No Posts';
|
|
|
|
const rendered = plural.call({}, 0, {
|
|
hash: {
|
|
empty: 'No Posts',
|
|
singular: '% Post',
|
|
plural: '% Posts'
|
|
}
|
|
});
|
|
|
|
should.exist(rendered);
|
|
rendered.string.should.equal(expected);
|
|
});
|
|
|
|
it('will show no-value string with placement', function () {
|
|
const expected = '0 Posts';
|
|
|
|
const rendered = plural.call({}, 0, {
|
|
hash: {
|
|
empty: '% Posts',
|
|
singular: '% Post',
|
|
plural: '% Posts'
|
|
}
|
|
});
|
|
|
|
should.exist(rendered);
|
|
rendered.string.should.equal(expected);
|
|
});
|
|
|
|
it('will show singular string', function () {
|
|
const expected = '1 Post';
|
|
|
|
const rendered = plural.call({}, 1, {
|
|
hash: {
|
|
empty: 'No Posts',
|
|
singular: '% Post',
|
|
plural: '% Posts'
|
|
}
|
|
});
|
|
|
|
should.exist(rendered);
|
|
rendered.string.should.equal(expected);
|
|
});
|
|
|
|
it('will show plural string', function () {
|
|
const expected = '2 Posts';
|
|
|
|
const rendered = plural.call({}, 2, {
|
|
hash: {
|
|
empty: 'No Posts',
|
|
singular: '% Post',
|
|
plural: '% Posts'
|
|
}
|
|
});
|
|
|
|
should.exist(rendered);
|
|
rendered.string.should.equal(expected);
|
|
});
|
|
});
|