Skip to content

Commit

Permalink
WIP.
Browse files Browse the repository at this point in the history
  • Loading branch information
Syndesi committed Mar 1, 2024
1 parent 45047d4 commit 723c2df
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 16 deletions.
3 changes: 3 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ const config: Config = {

// The paths to modules that run some code to configure or set up the testing environment before each test
// setupFiles: [],
setupFiles: [
"./test/setup.ts"
],

// A list of paths to modules that run some code to configure or set up the testing framework before each test
// setupFilesAfterEnv: [],
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"cs": "eslint . --ext .ts ./src ./test",
"cs:fix": "eslint --ext .ts ./src ./test --fix",
"test:unit": "jest ./test/Unit",
"test:feature": "instant-mocha ---webpack-config webpack.config.cjs --mode development 'test/Feature/**/*.ts'",
"test:feature": "jest ./test/Feature",
"test:unit:old": "mocha --config .mocharc.unit.json",
"test:feature:old": "mocha --config .mocharc.feature.json",
"prepare": "ts-patch install"
Expand All @@ -26,8 +26,7 @@
"luxon": "^3.4.4",
"reflect-metadata": "^0.1.13",
"tslog": "^4.8.2",
"typedi": "^0.10.0",
"uuid": "^9.0.0"
"typedi": "^0.10.0"
},
"devDependencies": {
"@happy-dom/global-registrator": "^12.10.3",
Expand Down
12 changes: 12 additions & 0 deletions src/Endpoint/Element/GetElementEndpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ class GetElementEndpoint {
) {}

async getElement(uuid: Uuid): Promise<Node | Relation> {
return this.fetchHelper
.runWrappedFetch(`/${uuid}`, this.fetchHelper.getDefaultGetOptions())
.then((response) => {
if (!response.ok) return Promise.reject(new Error('Problem with request.'));
return response.json();
})
.then<Node | Relation>((jsonResponse) => {
return this.elementParser.rawElementToNodeOrRelation(jsonResponse);
});
}

async getElementOld(uuid: Uuid): Promise<Node | Relation> {
return new Promise<Node | Relation>((resolve, reject) => {
this.fetchHelper
.runWrappedFetch(`/${uuid}`, this.fetchHelper.getDefaultGetOptions())
Expand Down
6 changes: 0 additions & 6 deletions test/Feature/bootstrap.ts

This file was deleted.

1 change: 0 additions & 1 deletion test/Unit/Service/RawValueToNormalizedValueHelper.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'reflect-metadata';
import { expect } from 'chai';
import { DateTime } from 'luxon';
import { SinonSandbox, SinonStubbedInstance, createSandbox } from 'sinon';
Expand Down
6 changes: 0 additions & 6 deletions test/Unit/bootstrap.ts

This file was deleted.

6 changes: 6 additions & 0 deletions test/setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import 'reflect-metadata';

import chai = require('chai');
import chaiAsPromised = require('chai-as-promised');

chai.use(chaiAsPromised);

0 comments on commit 723c2df

Please sign in to comment.