webclient/test/test.browser.ts

33 lines
1.0 KiB
TypeScript
Raw Permalink Normal View History

2023-08-27 12:16:09 +02:00
import { expect, tap } from '@push.rocks/tapbundle';
2022-08-01 18:02:06 +02:00
import * as webclient from '../ts/index.js';
2020-09-19 15:18:28 +00:00
let testClient: webclient.CsWebclient;
tap.test('should create an instance of webclient', async () => {
testClient = new webclient.CsWebclient();
2022-08-01 18:02:06 +02:00
expect(testClient).toBeInstanceOf(webclient.CsWebclient);
2020-09-19 15:18:28 +00:00
});
tap.test('should return false when asked for present settings', async () => {
const result = await testClient.isCookieLevelSet();
2022-08-01 18:02:06 +02:00
expect(result).toBeFalse();
2020-09-19 15:18:28 +00:00
});
tap.test('should create a cookielevel setting', async () => {
await testClient.setCookieLevels(['functional']);
const result = await testClient.getCookieLevels();
2022-08-01 18:02:06 +02:00
expect(result).toContain('functional');
2020-09-19 15:18:28 +00:00
});
tap.test('should return true when asked for present settings', async () => {
const result = await testClient.isCookieLevelSet();
2022-08-01 18:02:06 +02:00
expect(result).toBeTrue();
2020-09-19 15:18:28 +00:00
});
tap.test('should validity for present settings', async () => {
const result = await testClient.isCookieLevelStillValid();
2022-08-01 18:02:06 +02:00
expect(result).toBeTrue();
2020-09-19 15:18:28 +00:00
});
tap.start();