feat: begin working on integration tests that will call actual onspring api sandbox
This commit is contained in:
+1
-1
@@ -13,7 +13,7 @@
|
|||||||
],
|
],
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"files": ["tests/**/*.spec.ts"],
|
"files": ["tests/**/*.spec.ts", "integrationTests/**/*.spec.ts"],
|
||||||
"rules": {
|
"rules": {
|
||||||
"@typescript-eslint/no-unused-expressions": "off",
|
"@typescript-eslint/no-unused-expressions": "off",
|
||||||
"@typescript-eslint/consistent-type-assertions": "off",
|
"@typescript-eslint/consistent-type-assertions": "off",
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import { OnspringClient } from '../src/index';
|
||||||
|
import { expect } from 'chai';
|
||||||
|
import * as dotenv from 'dotenv';
|
||||||
|
import path from 'path';
|
||||||
|
const envPath = path.resolve(__dirname, '.env');
|
||||||
|
dotenv.config({ path: envPath });
|
||||||
|
|
||||||
|
describe('getApps', function () {
|
||||||
|
const baseURL = 'https://api.onspring.com';
|
||||||
|
let apiKey;
|
||||||
|
|
||||||
|
before(function () {
|
||||||
|
apiKey = process.env.SANDBOX_API_KEY;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return a list of apps', async function () {
|
||||||
|
const client = new OnspringClient(baseURL, apiKey);
|
||||||
|
const response = await client.getApps();
|
||||||
|
|
||||||
|
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.not.be.null;
|
||||||
|
expect(response.data.pageSize).to.not.be.null;
|
||||||
|
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;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
Generated
+13
@@ -20,6 +20,7 @@
|
|||||||
"@typescript-eslint/eslint-plugin": "^5.50.0",
|
"@typescript-eslint/eslint-plugin": "^5.50.0",
|
||||||
"@typescript-eslint/parser": "^5.50.0",
|
"@typescript-eslint/parser": "^5.50.0",
|
||||||
"chai": "^4.3.7",
|
"chai": "^4.3.7",
|
||||||
|
"dotenv": "^16.0.3",
|
||||||
"eslint": "^8.33.0",
|
"eslint": "^8.33.0",
|
||||||
"eslint-config-prettier": "^8.6.0",
|
"eslint-config-prettier": "^8.6.0",
|
||||||
"eslint-config-standard-with-typescript": "^34.0.0",
|
"eslint-config-standard-with-typescript": "^34.0.0",
|
||||||
@@ -35,6 +36,9 @@
|
|||||||
"sinon": "^15.0.1",
|
"sinon": "^15.0.1",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^4.9.5"
|
"typescript": "^4.9.5"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.14.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@ampproject/remapping": {
|
"node_modules/@ampproject/remapping": {
|
||||||
@@ -1896,6 +1900,15 @@
|
|||||||
"node": ">=6.0.0"
|
"node": ">=6.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/dotenv": {
|
||||||
|
"version": "16.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
|
||||||
|
"integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/electron-to-chromium": {
|
"node_modules/electron-to-chromium": {
|
||||||
"version": "1.4.284",
|
"version": "1.4.284",
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz",
|
||||||
|
|||||||
+4
-1
@@ -40,8 +40,10 @@
|
|||||||
"format-staged": "pretty-quick --staged",
|
"format-staged": "pretty-quick --staged",
|
||||||
"format": "pretty-quick",
|
"format": "pretty-quick",
|
||||||
"build": "npm run lint-fix && npm run tests && npm run format && npm run clean && tsc --project tsconfig.cjs.json & tsc --project tsconfig.esm.json",
|
"build": "npm run lint-fix && npm run tests && npm run format && npm run clean && tsc --project tsconfig.cjs.json & tsc --project tsconfig.esm.json",
|
||||||
"tests": "mocha -R progress -r ts-node/register ./tests/**/*.spec.ts",
|
|
||||||
"test": "mocha -r ts-node/register",
|
"test": "mocha -r ts-node/register",
|
||||||
|
"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",
|
||||||
"prepare": "husky install"
|
"prepare": "husky install"
|
||||||
},
|
},
|
||||||
@@ -53,6 +55,7 @@
|
|||||||
"@typescript-eslint/eslint-plugin": "^5.50.0",
|
"@typescript-eslint/eslint-plugin": "^5.50.0",
|
||||||
"@typescript-eslint/parser": "^5.50.0",
|
"@typescript-eslint/parser": "^5.50.0",
|
||||||
"chai": "^4.3.7",
|
"chai": "^4.3.7",
|
||||||
|
"dotenv": "^16.0.3",
|
||||||
"eslint": "^8.33.0",
|
"eslint": "^8.33.0",
|
||||||
"eslint-config-prettier": "^8.6.0",
|
"eslint-config-prettier": "^8.6.0",
|
||||||
"eslint-config-standard-with-typescript": "^34.0.0",
|
"eslint-config-standard-with-typescript": "^34.0.0",
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { OnspringClient } from './models/OnspringClient';
|
||||||
|
|
||||||
|
export { OnspringClient };
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"extends": "./tsconfig.json",
|
"extends": "./tsconfig.json",
|
||||||
"include": ["src/**/*.ts", "tests/**/*.ts"]
|
"include": ["src/**/*.ts", "tests/**/*.ts", "integrationTests/**/*.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user