Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"checkCoverage": true,
"branches": 100,
"lines": 100,
"functions": 100,
"statements": 100,
"all": true,
"include": ["src/**/*.ts"],
"exclude": ["src/index.ts", "**/*.spec.ts"],
"reporter": ["html", "lcov", "text", "text-summary"],
"reportsDir": "coverage"
}
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

41 changes: 0 additions & 41 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/lint_format_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x, 20.x]
node-version: [20.x, 22.x, 24.x, 26.x]
fail-fast: false
steps:
- name: Check out repository
Expand Down
23 changes: 0 additions & 23 deletions .nycrc

This file was deleted.

52 changes: 52 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

const typeCheckedFiles = [
'src/**/*.ts',
'tests/**/*.ts',
'integrationTests/**/*.ts',
];

export default [
{ ignores: ['coverage/', 'docs/', 'scripts/', 'dist/', 'eslint.config.*'] },
eslint.configs.recommended,
...tseslint.configs.recommended,
{
files: typeCheckedFiles,
languageOptions: {
parserOptions: { project: './tsconfig.eslint.json' },
},
},
{
files: [
'tests/**/*.spec.ts',
'integrationTests/**/*.spec.ts',
'integrationTests/utils/**',
],
rules: {
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/consistent-type-assertions': 'off',
'no-new': 'off',
},
},
{
languageOptions: {
globals: {
after: 'readonly',
afterEach: 'readonly',
before: 'readonly',
beforeEach: 'readonly',
describe: 'readonly',
it: 'readonly',
xdescribe: 'readonly',
xit: 'readonly',
},
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'off',
'@typescript-eslint/no-useless-constructor': 'off',
'@typescript-eslint/no-extraneous-class': 'off',
},
},
];
11 changes: 5 additions & 6 deletions integrationTests/Apps/getAppById.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { OnspringClient } from '../../src';
import { getClient } from '../mochaRootHooks';
import { expect } from 'chai';
import { baseURL, apiKey } from '../mochaRootHooks';

describe('getAppById', function () {
this.timeout(30000);
this.retries(3);

it('should return an app', async function () {
const client = new OnspringClient(baseURL, apiKey);
const client = getClient();

if (process.env.TEST_APP_ID === undefined) {
return expect.fail('TEST_APP_ID is not defined');
Expand All @@ -29,7 +28,7 @@ describe('getAppById', function () {
});

it('should return a 401 error when an invalid api key is used', async function () {
const client = new OnspringClient(baseURL, 'invalid');
const client = getClient('invalid');
const response = await client.getAppById(1);

expect(response.statusCode).to.equal(401);
Expand All @@ -39,7 +38,7 @@ describe('getAppById', function () {
});

it('should return a 403 error when api key does not have access to the requested app', async function () {
const client = new OnspringClient(baseURL, apiKey);
const client = getClient();

if (process.env.TEST_APP_ID_NO_ACCESS === undefined) {
return expect.fail('TEST_APP_ID_NO_ACCESS is not defined');
Expand All @@ -55,7 +54,7 @@ describe('getAppById', function () {
});

it('should return a 404 error when an app id cannot be found', async function () {
const client = new OnspringClient(baseURL, apiKey);
const client = getClient();
const response = await client.getAppById(0);

expect(response.statusCode).to.equal(404);
Expand Down
12 changes: 6 additions & 6 deletions integrationTests/Apps/getApps.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { OnspringClient, PagingRequest } from '../../src';
import { PagingRequest } from '../../src';
import { expect } from 'chai';
import { baseURL, apiKey } from '../mochaRootHooks';
import { getClient } from '../mochaRootHooks';

describe('getApps', function () {
this.timeout(30000);
this.retries(3);

it('should return a paged list of apps', async function () {
const client = new OnspringClient(baseURL, apiKey);
const client = getClient();
const response = await client.getApps();

expect(response.statusCode).to.equal(200);
Expand All @@ -34,7 +34,7 @@ describe('getApps', function () {
});

it('should return a paged list of apps with with correct page size and number when passed paging request', async function () {
const client = new OnspringClient(baseURL, apiKey);
const client = getClient();
const response = await client.getApps(new PagingRequest(1, 1));

expect(response.statusCode).to.equal(200);
Expand All @@ -61,7 +61,7 @@ describe('getApps', function () {
});

it('should return a 400 response when an invalid page size is used', async function () {
const client = new OnspringClient(baseURL, apiKey);
const client = getClient();
const response = await client.getApps({ pageNumber: 1, pageSize: 1001 });

expect(response.statusCode).to.equal(400);
Expand All @@ -71,7 +71,7 @@ describe('getApps', function () {
});

it('should return a 401 response when an invalid api key is used', async function () {
const client = new OnspringClient(baseURL, 'invalid');
const client = getClient('invalid');
const response = await client.getApps();

expect(response.statusCode).to.equal(401);
Expand Down
9 changes: 4 additions & 5 deletions integrationTests/Apps/getAppsByIds.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { OnspringClient } from '../../src';
import { getClient } from '../mochaRootHooks';
import { expect } from 'chai';
import { baseURL, apiKey } from '../mochaRootHooks';

describe('getAppsByIds', function () {
this.timeout(30000);
this.retries(3);

it('should return a collection of apps', async function () {
const client = new OnspringClient(baseURL, apiKey);
const client = getClient();
const appIds = process.env.TEST_APP_IDS;

if (appIds === undefined) {
Expand Down Expand Up @@ -37,7 +36,7 @@ describe('getAppsByIds', function () {
});

it('should return a 401 error when an invalid api key is used', async function () {
const client = new OnspringClient(baseURL, 'invalid');
const client = getClient('invalid');
const response = await client.getAppsByIds([1]);

expect(response.statusCode).to.equal(401);
Expand All @@ -47,7 +46,7 @@ describe('getAppsByIds', function () {
});

it('should return a 403 error when api key does not have access to any of the requested app', async function () {
const client = new OnspringClient(baseURL, apiKey);
const client = getClient();
const appIds = process.env.TEST_APP_IDS_NO_ACCESS;

if (appIds === undefined) {
Expand Down
11 changes: 5 additions & 6 deletions integrationTests/Fields/getFieldById.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { OnspringClient } from '../../src';
import { getClient } from '../mochaRootHooks';
import { expect } from 'chai';
import { baseURL, apiKey } from '../mochaRootHooks';

describe('getAppById', function () {
this.timeout(30000);
this.retries(3);

it('should return a field', async function () {
const client = new OnspringClient(baseURL, apiKey);
const client = getClient();

if (process.env.TEST_FIELD_ID === undefined) {
return expect.fail('TEST_FIELD_ID is not defined');
Expand All @@ -33,7 +32,7 @@ describe('getAppById', function () {
});

it('should return a 401 error when an invalid api key is used', async function () {
const client = new OnspringClient(baseURL, 'invalid');
const client = getClient('invalid');
const response = await client.getFieldById(1);

expect(response.statusCode).to.equal(401);
Expand All @@ -43,7 +42,7 @@ describe('getAppById', function () {
});

it('should return a 403 error when api key does not have access to the requested field', async function () {
const client = new OnspringClient(baseURL, apiKey);
const client = getClient();

if (process.env.TEST_FIELD_ID_NO_ACCESS === undefined) {
return expect.fail('TEST_FIELD_ID_NO_ACCESS is not defined');
Expand All @@ -59,7 +58,7 @@ describe('getAppById', function () {
});

it('should return a 404 error when the requested field does not exist', async function () {
const client = new OnspringClient(baseURL, apiKey);
const client = getClient();
const response = await client.getFieldById(0);

expect(response.statusCode).to.equal(404);
Expand Down
14 changes: 7 additions & 7 deletions integrationTests/Fields/getFieldsByAppId.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { OnspringClient, PagingRequest } from '../../src';
import { PagingRequest } from '../../src';
import { expect } from 'chai';
import { baseURL, apiKey } from '../mochaRootHooks';
import { getClient } from '../mochaRootHooks';

describe('getFieldsByAppId', function () {
this.timeout(30000);
this.retries(3);

it('should return a paged list of fields', async function () {
const client = new OnspringClient(baseURL, apiKey);
const client = getClient();

if (process.env.TEST_SURVEY_ID === undefined) {
return expect.fail('TEST_SURVEY_ID is not defined');
Expand Down Expand Up @@ -44,7 +44,7 @@ describe('getFieldsByAppId', function () {
});

it('should return a paged list of fields with with correct page size and number when passed paging request', async function () {
const client = new OnspringClient(baseURL, apiKey);
const client = getClient();

if (process.env.TEST_SURVEY_ID === undefined) {
return expect.fail('TEST_SURVEY_ID is not defined');
Expand Down Expand Up @@ -84,7 +84,7 @@ describe('getFieldsByAppId', function () {
});

it('should return a 400 response when an invalid page size is used', async function () {
const client = new OnspringClient(baseURL, apiKey);
const client = getClient();

if (process.env.TEST_SURVEY_ID === undefined) {
return expect.fail('TEST_SURVEY_ID is not defined');
Expand All @@ -103,7 +103,7 @@ describe('getFieldsByAppId', function () {
});

it('should return a 401 response when an invalid api key is used', async function () {
const client = new OnspringClient(baseURL, 'invalid');
const client = getClient('invalid');
const response = await client.getFieldsByAppId(1);

expect(response.statusCode).to.equal(401);
Expand All @@ -113,7 +113,7 @@ describe('getFieldsByAppId', function () {
});

it('should return a 403 response when api key does not have access to the app', async function () {
const client = new OnspringClient(baseURL, apiKey);
const client = getClient();

if (process.env.TEST_APP_ID_NO_ACCESS === undefined) {
return expect.fail('TEST_APP_ID_NO_ACCESS is not defined');
Expand Down
Loading
Loading