Tuitio client tests
parent
0296973977
commit
590afef989
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"name": "Jest file",
|
||||||
|
"type": "pwa-node",
|
||||||
|
"request": "launch",
|
||||||
|
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/jest",
|
||||||
|
"args": ["${fileBasenameNoExtension}", "--runInBand", "--watch", "--coverage=false", "--no-cache"],
|
||||||
|
"cwd": "${workspaceRoot}",
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"internalConsoleOptions": "neverOpen",
|
||||||
|
"sourceMaps": true,
|
||||||
|
"windows": {
|
||||||
|
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
import { getUrlTemplates } from "../config";
|
import { getUrlTemplates } from "../config";
|
||||||
import { combineUrls } from "../utils";
|
import { combineUrls } from "../utils";
|
||||||
|
import { TuitioClient } from "../client";
|
||||||
|
|
||||||
test("Combine urls with trailing slash", () => {
|
test("Combine urls with trailing slash", () => {
|
||||||
const result = combineUrls("https://test.com/api/", "/test");
|
const result = combineUrls("https://test.com/api/", "/test");
|
||||||
|
@ -18,3 +19,8 @@ test("Get url templates", () => {
|
||||||
expect(result.authentication).toContain("{username}");
|
expect(result.authentication).toContain("{username}");
|
||||||
expect(result.authentication).toContain("{password}");
|
expect(result.authentication).toContain("{password}");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Tuitio client initialization", () => {
|
||||||
|
const result = new TuitioClient("https://test.com/api");
|
||||||
|
expect(result.baseUrl).toBe("https://test.com/api");
|
||||||
|
});
|
|
@ -51,7 +51,7 @@ const invalidate = (): void => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
type TuitioState = { token: string; userName: string };
|
export type TuitioState = { token: string; userName: string };
|
||||||
|
|
||||||
const fetch = (): TuitioState => {
|
const fetch = (): TuitioState => {
|
||||||
const data = {
|
const data = {
|
||||||
|
|
Loading…
Reference in New Issue