feat: begin implementing getReportsByAppId method
This commit is contained in:
@@ -942,4 +942,45 @@ describe('ApiResponse', function () {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('asGetPagedReportsResponse', function () {
|
||||
it('should be defined', function () {
|
||||
expect(ApiResponse.prototype.asGetPagedReportsResponseType).to.not.be
|
||||
.undefined;
|
||||
});
|
||||
|
||||
it('should be a function', function () {
|
||||
expect(ApiResponse.prototype.asGetPagedReportsResponseType).to.be.a(
|
||||
'function'
|
||||
);
|
||||
});
|
||||
|
||||
it('should have no parameters', function () {
|
||||
expect(
|
||||
ApiResponse.prototype.asGetPagedReportsResponseType.length
|
||||
).to.equal(0);
|
||||
});
|
||||
|
||||
it('should return an ApiResponse<GetPagedReportsResponse>', function () {
|
||||
const mockResponseData = [
|
||||
{
|
||||
appId: 1,
|
||||
id: 1,
|
||||
name: 'string',
|
||||
description: 'description',
|
||||
},
|
||||
{
|
||||
appId: 2,
|
||||
id: 2,
|
||||
name: 'string',
|
||||
description: 'description'
|
||||
}
|
||||
]
|
||||
|
||||
const apiResponse = new ApiResponse(200, 'OK', mockResponseData);
|
||||
const getPagedReportsResponse = apiResponse.asGetPagedReportsResponseType();
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -162,8 +162,11 @@ describe('EndpointFactory', function () {
|
||||
|
||||
describe('getReportsByAppIdEndpoint', function () {
|
||||
it('should return the correct reports by app id endpoint', function () {
|
||||
const result = EndpointFactory.getReportsByAppIdEndpoint(1);
|
||||
expect(result).to.equal('/Reports/appId/1');
|
||||
const result = EndpointFactory.getReportsByAppIdEndpoint(
|
||||
1,
|
||||
new PagingRequest(2, 1000)
|
||||
);
|
||||
expect(result).to.equal('/Reports/appId/1?pageSize=1000&pageNumber=2');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user