tests
parent
413594b6ed
commit
238e7010b4
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { TuitioClient } from "../client";
|
import { TuitioClient, fetch, invalidate } from "../client";
|
||||||
|
|
||||||
jest.mock("axios");
|
jest.mock("axios");
|
||||||
|
|
||||||
|
@ -22,4 +22,11 @@ test("Tuitio client authentication", async () => {
|
||||||
expect(result.token.validFrom).toStrictEqual(new Date("10/02/2023"));
|
expect(result.token.validFrom).toStrictEqual(new Date("10/02/2023"));
|
||||||
expect(result.token.validUntil).toStrictEqual(new Date("11/02/2023"));
|
expect(result.token.validUntil).toStrictEqual(new Date("11/02/2023"));
|
||||||
expect(result.status).toBe("_MOCK_");
|
expect(result.status).toBe("_MOCK_");
|
||||||
|
|
||||||
|
const storage = fetch();
|
||||||
|
expect(storage.userName).toBe("user");
|
||||||
|
|
||||||
|
invalidate();
|
||||||
|
const emptyStorage = fetch();
|
||||||
|
expect(emptyStorage.userName).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue