fix: added additional negative test cases for getApps method. feat: begin writing tests for getAppById method

This commit is contained in:
StevanFreeborn
2023-02-01 22:44:30 -06:00
parent 1d4d547c8a
commit 1a6d05a04a
4 changed files with 238 additions and 34 deletions
+29
View File
@@ -141,4 +141,33 @@ describe('ApiResponse', function () {
expect(appsPagedResponse.data.items).to.have.lengthOf(0);
});
});
describe('AsAppType', function () {
it('should be defined', function () {
expect(ApiResponse.prototype.AsAppType).to.not.be.undefined;
});
it('should have no parameters', function () {
expect(ApiResponse.prototype.AsAppType).to.have.lengthOf(0);
});
it('should return an ApiResponse<App> when data contain an app', function () {
var mockApiResponse = {
href: 'https://api.onspring.dev/apps/id/1',
id: 1,
name: 'Test App',
};
var apiResponse = new ApiResponse<any>(200, 'OK', mockApiResponse);
var appResponse = apiResponse.AsAppType();
expect(appResponse).to.be.instanceOf(ApiResponse);
expect(appResponse.data).to.be.instanceOf(App);
expect(appResponse.data.id).to.equal(1);
expect(appResponse.data.name).to.equal('Test App');
expect(appResponse.data.href).to.equal(
'https://api.onspring.dev/apps/id/1'
);
});
});
});