-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtemba-store.test.ts
45 lines (38 loc) · 1.38 KB
/
temba-store.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { assert, fixture } from '@open-wc/testing';
import { Store } from '../src/store/Store';
import './utils.test';
const createStore = async (def: string): Promise<Store> => {
const store = (await fixture(def)) as Store;
await store.initialHttpComplete;
return store;
};
describe('temba-store', () => {
it('is defined', async () => {
const store = await createStore('<temba-store></temba-store>');
assert.instanceOf(store, Store);
});
it('completion schema', async () => {
const store: Store = await createStore(
"<temba-store completion='/test-assets/store/editor.json'></temba-store>"
);
assert.equal(store.getCompletionSchema().types.length, 16);
assert.equal(store.getFunctions().length, 80);
});
it('globals', async () => {
const store: Store = await createStore(
"<temba-store globals='/test-assets/store/globals.json'></temba-store>"
);
assert.equal(store.getKeyedAssets().globals.length, 2);
});
it('fields', async () => {
const store: Store = await createStore(
"<temba-store fields='/test-assets/store/fields.json'></temba-store>"
);
assert.equal(store.getKeyedAssets().fields.length, 8);
});
it('exposes postUrl', async () => {
const store = await createStore('<temba-store></temba-store>');
const response = await store.postUrl('/no-endpoint');
assert.equal(response.status, 404);
});
});