mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Added test coverage for {{max}} and {{count}}
refs https://github.com/TryGhost/Team/issues/510 - {{max}} and {{count}} variable usage was not covered but had valid usecases in the library client's, so considered to "document" them through tests - For more context these variables are available in custom `error` templates that are provided with each limit
This commit is contained in:
parent
36dd9219c9
commit
01f18aa4fa
1 changed files with 18 additions and 0 deletions
|
@ -35,6 +35,24 @@ describe('Limit Service', function () {
|
|||
error.errorDetails.limit.should.eql(35000000);
|
||||
error.errorDetails.total.should.eql(35000001);
|
||||
});
|
||||
|
||||
it('Supports {{max}} and {{count}} variables', function () {
|
||||
let limit = new MaxLimit({
|
||||
name: 'test',
|
||||
config: {
|
||||
max: 5,
|
||||
currentCountQuery: () => {},
|
||||
error: 'Your plan supports up to {{max}} staff users. You are currently at {{count}} staff users.Please upgrade to add more.'
|
||||
},
|
||||
errors
|
||||
});
|
||||
|
||||
let error = limit.generateError(7);
|
||||
|
||||
error.message.should.eql('Your plan supports up to 5 staff users. You are currently at 7 staff users.Please upgrade to add more.');
|
||||
error.errorDetails.limit.should.eql(5);
|
||||
error.errorDetails.total.should.eql(7);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Loader', function () {
|
||||
|
|
Loading…
Add table
Reference in a new issue