feat: finish writing integration tests for getApps
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { OnspringClient } from '../src/index';
|
||||
import { OnspringClient, PagingRequest } from '../src/index';
|
||||
import { expect } from 'chai';
|
||||
import * as dotenv from 'dotenv';
|
||||
import path from 'path';
|
||||
@@ -39,4 +39,31 @@ describe('getApps', function () {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('should return a list of apps with with correct page size and number when passed paging request', async function () {
|
||||
const client = new OnspringClient(baseURL, apiKey);
|
||||
const response = await client.getApps(new PagingRequest(1, 1));
|
||||
|
||||
expect(response.statusCode).to.equal(200);
|
||||
expect(response.isSuccessful).to.be.true;
|
||||
expect(response.message).to.equal('');
|
||||
expect(response.data).to.not.be.null;
|
||||
|
||||
if (response.data != null) {
|
||||
expect(response.data.pageNumber).to.equal(1);
|
||||
expect(response.data.pageSize).to.equal(1);
|
||||
expect(response.data.totalPages).to.not.be.null;
|
||||
expect(response.data.totalRecords).to.not.be.null;
|
||||
expect(response.data.items).to.not.be.null;
|
||||
|
||||
if (response.data.items != null) {
|
||||
expect(response.data.items.length).to.be.greaterThan(0);
|
||||
response.data.items.forEach((item) => {
|
||||
expect(item.id).to.not.be.null;
|
||||
expect(item.name).to.not.be.null;
|
||||
expect(item.href).to.not.be.null;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
+2
-1
@@ -44,7 +44,8 @@
|
||||
"tests:unit": "mocha -R progress -r ts-node/register ./tests/**/*.spec.ts",
|
||||
"tests:integration": "mocha -R progress -r ts-node/register ./integrationTests/**/*.spec.ts",
|
||||
"tests": "mocha -R progress -r ts-node/register ./tests/**/*.spec.ts ./integrationTests/**/*.spec.ts",
|
||||
"test-coverage": "nyc npm run tests",
|
||||
"test-coverage": "nyc npm run tests:unit",
|
||||
"test-coverage:ci": "nyc npm run tests",
|
||||
"prepare": "husky install"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
import { OnspringClient } from './models/OnspringClient';
|
||||
import { PagingRequest } from './models/PagingRequest';
|
||||
|
||||
export { OnspringClient };
|
||||
export { OnspringClient, PagingRequest };
|
||||
|
||||
Reference in New Issue
Block a user