mirror of https://github.com/LemmyNet/lemmy.git
Adding a test bed for API testing. #658
parent
b8aaf5c1f1
commit
ce800f75ad
|
@ -1,2 +1,3 @@
|
|||
fuse.js
|
||||
translation_report.ts
|
||||
src/api_tests
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
globals: {
|
||||
'ts-jest': {
|
||||
diagnostics: false,
|
||||
},
|
||||
},
|
||||
};
|
|
@ -6,6 +6,7 @@
|
|||
"license": "AGPL-3.0-or-later",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"api-test": "jest src/api_tests/api.spec.ts",
|
||||
"build": "node fuse prod",
|
||||
"lint": "tsc --noEmit && eslint --report-unused-disable-directives --ext .js,.ts,.tsx src",
|
||||
"prebuild": "node generate_translations.js",
|
||||
|
@ -38,6 +39,7 @@
|
|||
"markdown-it-emoji": "^1.4.0",
|
||||
"mobius1-selectr": "^2.4.13",
|
||||
"moment": "^2.24.0",
|
||||
"node-fetch": "^2.6.0",
|
||||
"prettier": "^2.0.4",
|
||||
"reconnecting-websocket": "^4.4.0",
|
||||
"rxjs": "^6.5.5",
|
||||
|
@ -49,12 +51,16 @@
|
|||
"ws": "^7.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^25.2.1",
|
||||
"@types/node-fetch": "^2.5.6",
|
||||
"eslint": "^6.5.1",
|
||||
"eslint-plugin-inferno": "^7.14.3",
|
||||
"eslint-plugin-jane": "^7.2.1",
|
||||
"fuse-box": "^3.1.3",
|
||||
"jest": "^25.4.0",
|
||||
"lint-staged": "^10.1.3",
|
||||
"sortpack": "^2.1.4",
|
||||
"ts-jest": "^25.4.0",
|
||||
"ts-node": "^8.8.2",
|
||||
"ts-transform-classcat": "^1.0.0",
|
||||
"ts-transform-inferno": "^4.0.3",
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
import fetch from 'node-fetch';
|
||||
|
||||
test('adds 1 + 2 to equal 3', () => {
|
||||
let sum = (a: number, b: number) => a + b;
|
||||
expect(sum(1, 2)).toBe(3);
|
||||
});
|
||||
|
||||
test('Get communism.lemmy.ml nodeinfo href', async () => {
|
||||
let url = 'https://communism.lemmy.ml/.well-known/nodeinfo';
|
||||
let href = 'https://communism.lemmy.ml/nodeinfo/2.0.json';
|
||||
let res = await fetch(url).then(d => d.json());
|
||||
expect(res.links.href).toBe(href);
|
||||
});
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue