fix: add missing tests

This commit is contained in:
StevanFreeborn
2023-01-26 22:40:13 -06:00
parent 12f32bc731
commit 9ab72bd37c
7 changed files with 142 additions and 19 deletions
+32
View File
@@ -0,0 +1,32 @@
import { PagingRequest } from '../src/models/PagingRequest';
import { expect } from 'chai';
describe('PagingRequest', function () {
it('should be defined', function () {
expect(PagingRequest).to.not.be.undefined;
});
it('should have a constructor', function () {
expect(PagingRequest).to.have.property('constructor');
});
it('should have 2 parameters', function () {
expect(PagingRequest).to.have.lengthOf(2);
});
it('should throw an error when the pageNumber is less than 1', function () {
expect(() => new PagingRequest(0, 1)).to.throw('pageNumber must be greater than 0.');
});
it('should throw an error when the pageSize is less than 1', function () {
expect(() => new PagingRequest(1, 0)).to.throw('pageSize must be greater than 0 and less than 1001.');
});
it('should throw an error when the pageSize is greater than 1000', function () {
expect(() => new PagingRequest(1, 1001)).to.throw('pageSize must be greater than 0 and less than 1001.');
});
it('should create a new instance of the PagingRequest class when the pageNumber is greater than 0 and the pageSize is between 1 and 1000', function () {
expect(() => new PagingRequest(1, 1)).to.not.throw();
});
});