test: add unit tests to pipeline

This commit is contained in:
2023-05-31 15:33:19 +02:00
parent 45444d9373
commit 495a63977c
29 changed files with 232 additions and 484 deletions

View File

@@ -22,7 +22,8 @@
},
"scripts": {
"build": "tsup --dts",
"format": "prettier . --ignore-path ../../.gitignore",
"docs": "typedoc --json ./docs/docs.json --options ../../typedoc.base.json src/index.ts",
"format": "prettier . -c --ignore-path ../../.gitignore",
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
"lint": "eslint --ext .ts src/",
"lint:fix": "eslint --fix --ext .ts src/",
@@ -67,7 +68,7 @@
"@types/fs-extra": "9.0.13",
"@types/json-schema": "7.0.11",
"@types/mocha": "10.0.1",
"c8": "7.13.0",
"c8": "7.14.0",
"chai": "4.3.7",
"chai-as-promised": "7.1.1",
"chai-spies": "1.0.0",
@@ -77,6 +78,7 @@
"nock": "13.3.1",
"ts-node": "10.9.1",
"tsup": "6.7.0",
"typedoc": "0.24.7",
"typescript": "4.8.4"
},
"peerDependencies": {

View File

@@ -26,7 +26,7 @@ import {
SCThingUpdateRoute,
} from '@openstapps/core';
import moment from 'moment';
import clone = require('rfdc');
import clone from 'rfdc';
import {v5} from 'uuid';
import {Bulk} from './bulk.js';
import {Client} from './client.js';
@@ -210,12 +210,12 @@ export class ConnectorClient extends Client {
* @see ConnectorClient.bulk
*/
async index<T extends SCThings>(things: T[], source?: string, timeout?: number): Promise<void> {
// check that number of things is not zero
// check that the number of things is not zero
if (things.length === 0) {
throw new EmptyBulkError();
}
// set default source if none is given
// set the default source if none is given
const thingSource = typeof source === 'undefined' ? 'stapps-api' : source;
// request a new bulk

View File

@@ -6,7 +6,8 @@
"main": "lib/index.js",
"scripts": {
"build": "tsup --dts",
"format": "prettier . --ignore-path ../../.gitignore",
"docs": "typedoc --json ./docs/docs.json --options ../../typedoc.base.json src/index.ts",
"format": "prettier . -c --ignore-path ../../.gitignore",
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
"lint": "eslint --ext .ts src/",
"lint:fix": "eslint --fix --ext .ts src/",
@@ -19,11 +20,12 @@
"@types/chai": "4.3.5",
"@types/mocha": "10.0.1",
"@types/node": "18.15.3",
"c8": "7.13.0",
"c8": "7.14.0",
"chai": "4.3.7",
"mocha": "10.2.0",
"ts-node": "10.9.1",
"tsup": "6.7.0",
"typedoc": "0.24.7",
"typescript": "4.8.4"
},
"tsup": {

View File

@@ -27,7 +27,8 @@
},
"scripts": {
"build": "tsup --dts",
"format": "prettier . --ignore-path ../../.gitignore",
"docs": "typedoc --json ./docs/docs.json --options ../../typedoc.base.json src/index.ts",
"format": "prettier . -c --ignore-path ../../.gitignore",
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
"lint": "eslint --ext .ts src/",
"lint:fix": "eslint --fix --ext .ts src/",
@@ -70,12 +71,13 @@
"@types/mocha": "10.0.1",
"@types/mustache": "4.2.2",
"@types/node": "18.15.3",
"c8": "7.13.0",
"c8": "7.14.0",
"chai": "4.3.7",
"mocha": "10.2.0",
"nock": "13.3.1",
"ts-node": "10.9.1",
"tsup": "6.7.0",
"typedoc": "0.24.7",
"typescript": "4.8.4"
},
"tsup": {

View File

@@ -27,7 +27,8 @@
"types": "./lib/index.d.ts",
"scripts": {
"build": "tsup --dts && pnpm run mappings && pnpm run schema",
"format": "prettier . --ignore-path ../../.gitignore",
"docs": "typedoc --json ./docs/docs.json --options ../../typedoc.base.json src/index.ts",
"format": "prettier . -c --ignore-path ../../.gitignore",
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
"lint": "eslint --ext .ts src/",
"lint:fix": "eslint --fix --ext .ts src/",
@@ -59,7 +60,7 @@
"@types/node": "18.15.3",
"@typescript-eslint/eslint-plugin": "5.49.0",
"@typescript-eslint/parser": "5.49.0",
"c8": "7.13.0",
"c8": "7.14.0",
"chai": "4.3.7",
"conditional-type-checks": "1.0.6",
"mocha": "10.2.0",
@@ -67,6 +68,7 @@
"surge": "0.23.1",
"ts-node": "10.9.1",
"tsup": "6.7.0",
"typedoc": "0.24.7",
"typescript": "4.8.4"
},
"tsup": {

View File

@@ -10,7 +10,8 @@
"types": "./lib/index.d.ts",
"scripts": {
"build": "tsup --dts",
"format": "prettier . --ignore-path ../../.gitignore",
"docs": "typedoc --json ./docs/docs.json --options ../../typedoc.base.json src/index.ts",
"format": "prettier . -c --ignore-path ../../.gitignore",
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
"lint": "eslint --ext .ts src/",
"lint:fix": "eslint --fix --ext .ts src/",
@@ -29,11 +30,12 @@
"@types/chai": "4.3.5",
"@types/mocha": "10.0.1",
"@types/node": "18.15.3",
"c8": "7.13.0",
"c8": "7.14.0",
"chai": "4.3.7",
"mocha": "10.2.0",
"ts-node": "10.9.1",
"tsup": "6.7.0"
"tsup": "6.7.0",
"typedoc": "0.24.7"
},
"tsup": {
"entry": [

View File

@@ -26,7 +26,10 @@ const tests = await Promise.all(
})),
);
describe('Easy AST', async function () {
describe('Easy AST', function () {
this.timeout(5000);
this.slow(2000);
it('should build the project', function () {
const project = lightweightProjectFromPath(projectPath, true);
expect(Object.keys(project).length).to.equal(tests.length);

View File

@@ -12,7 +12,7 @@
},
"scripts": {
"build": "rimraf lib && tsc",
"format": "prettier . --ignore-path ../../.gitignore",
"format": "prettier . -c --ignore-path ../../.gitignore",
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
"lint": "eslint -c .eslintrc --ignore-path .eslintignore --ext .ts src/ test/",
"lint:fix": "eslint --fix -c .eslintrc --ignore-path .eslintignore --ext .ts src/ test/",
@@ -35,7 +35,7 @@
"@types/mocha": "10.0.1",
"@types/node": "14.18.38",
"@types/rimraf": "3.0.2",
"c8": "7.13.0",
"c8": "7.14.0",
"chai": "4.3.7",
"mocha": "10.2.0",
"nock": "13.3.1",

View File

@@ -16,7 +16,8 @@
},
"scripts": {
"build": "tsup --dts",
"format": "prettier . --ignore-path ../../.gitignore",
"docs": "typedoc --json ./docs/docs.json --options ../../typedoc.base.json src/api.ts",
"format": "prettier . -c --ignore-path ../../.gitignore",
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
"lint": "eslint --ext .ts src/",
"lint:fix": "eslint --fix --ext .ts src/"

View File

@@ -15,7 +15,8 @@
"types": "./lib/index.d.ts",
"scripts": {
"build": "tsup --dts",
"format": "prettier . --ignore-path ../../.gitignore",
"docs": "typedoc --json ./docs/docs.json --options ../../typedoc.base.json src/index.ts",
"format": "prettier . -c --ignore-path ../../.gitignore",
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
"lint": "eslint --ext .ts src/",
"lint:fix": "eslint --fix --ext .ts src/",
@@ -36,7 +37,7 @@
"@types/chai-spies": "1.0.3",
"@types/mocha": "10.0.1",
"@types/node": "18.15.3",
"c8": "7.13.0",
"c8": "7.14.0",
"chai": "4.3.7",
"chai-as-promised": "7.1.1",
"chai-spies": "1.0.0",