bt-core-app 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bt-core-app.js +14124 -10473
- package/dist/components/BT-Field-Checkbox.vue.d.ts +56 -0
- package/dist/components/BT-Field-Date.vue.d.ts +64 -0
- package/dist/components/BT-Field-Entity.vue.d.ts +46 -0
- package/dist/components/BT-Field-Select.vue.d.ts +54 -0
- package/dist/components/BT-Field-String.vue.d.ts +53 -0
- package/dist/components/BT-Field-Switch.vue.d.ts +51 -0
- package/dist/components/BT-Field-Tags.vue.d.ts +51 -0
- package/dist/components/BT-Field-Textarea.vue.d.ts +52 -0
- package/dist/components/BT-Field-Trigger.vue.d.ts +79 -0
- package/dist/components/BT-Header-Option.vue.d.ts +18 -0
- package/dist/components/BT-Json.vue.d.ts +8 -0
- package/dist/components/BT-Select-List-Box.vue.d.ts +108 -0
- package/dist/components/BT-Select.vue.d.ts +53 -0
- package/dist/components/BT-Snack.vue.d.ts +33 -0
- package/dist/composables/list.d.ts +9 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/BT-Field-Date.vue +1 -5
- package/src/composables/auth.ts +8 -2
- package/test/auth.test.ts +68 -0
- package/test/stores-last-update.test.ts +4 -4
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { describe, test, expect, afterAll, afterEach, beforeAll } from 'vitest'
|
|
2
|
+
import { createAuth, useAuth } from '../src/composables/auth'
|
|
3
|
+
import { setupServer } from 'msw/node'
|
|
4
|
+
import { http, HttpResponse } from 'msw'
|
|
5
|
+
|
|
6
|
+
const handlers = [
|
|
7
|
+
http.get('https://test-api/get/1', () => {
|
|
8
|
+
return HttpResponse.json({
|
|
9
|
+
data: { test: 'a' },
|
|
10
|
+
count: 0,
|
|
11
|
+
filters: ['test']
|
|
12
|
+
})
|
|
13
|
+
}),
|
|
14
|
+
http.get('https://test-api/get/2', () => {
|
|
15
|
+
return new HttpResponse('not found', {
|
|
16
|
+
status: 304
|
|
17
|
+
})
|
|
18
|
+
}),
|
|
19
|
+
http.get('https://test-api/getAll', () => {
|
|
20
|
+
return HttpResponse.json({
|
|
21
|
+
data: [{ test: 'a' }, { test: 'b' }],
|
|
22
|
+
count: 2,
|
|
23
|
+
filters: ['test', 'test two']
|
|
24
|
+
})
|
|
25
|
+
}),
|
|
26
|
+
http.post('https://test-api/post', () => {
|
|
27
|
+
return HttpResponse.json({ data: { test: 'b' } })
|
|
28
|
+
}),
|
|
29
|
+
http.patch('https://test-api/patch', () => {
|
|
30
|
+
return HttpResponse.json({ data: { test: 'c' } })
|
|
31
|
+
})
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
const server = setupServer(...handlers)
|
|
35
|
+
|
|
36
|
+
beforeAll(() => server.listen({ onUnhandledRequest: 'error' }))
|
|
37
|
+
|
|
38
|
+
afterAll(() => server.close())
|
|
39
|
+
|
|
40
|
+
afterEach(() => server.resetHandlers())
|
|
41
|
+
|
|
42
|
+
describe('default auth', () => {
|
|
43
|
+
const auth = createAuth({
|
|
44
|
+
defaultTimeZone: 'Aus',
|
|
45
|
+
getAuthItem: () => { return {}},
|
|
46
|
+
getAuthUrl: () => ''
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
test('creates successfully', () => {
|
|
50
|
+
const state = auth.authState
|
|
51
|
+
const creds = auth.credentials
|
|
52
|
+
|
|
53
|
+
expect(state).not.toBeNull()
|
|
54
|
+
expect(auth.credentials).not.toBeNull()
|
|
55
|
+
expect(creds.timeZone).toEqual('Aus')
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
test('use successfully', () => {
|
|
59
|
+
const a = useAuth()
|
|
60
|
+
|
|
61
|
+
expect(a.authState).toEqual(auth.authState)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
test('login', () => {
|
|
66
|
+
auth.login()
|
|
67
|
+
})
|
|
68
|
+
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { setActivePinia, createPinia } from 'pinia'
|
|
2
|
-
import {
|
|
2
|
+
import { createSessionStoreDefinition, createWholeLastUpdateStoreDefinition } from '../src/composables/stores'
|
|
3
3
|
import { createApi } from '../src/composables/api'
|
|
4
4
|
import { describe, test, expect, beforeEach, afterAll, afterEach, beforeAll } from 'vitest'
|
|
5
5
|
import { setupServer } from 'msw/node'
|
|
@@ -49,8 +49,8 @@ describe('use last update store no api no caching', () => {
|
|
|
49
49
|
|
|
50
50
|
setActivePinia(pinia)
|
|
51
51
|
|
|
52
|
-
const store =
|
|
53
|
-
api:
|
|
52
|
+
const store = createWholeLastUpdateStoreDefinition({
|
|
53
|
+
api: undefined,
|
|
54
54
|
storageMode: 'session',
|
|
55
55
|
storeName: 'whole'
|
|
56
56
|
})()
|
|
@@ -95,7 +95,7 @@ describe('use last update store with api no caching', () => {
|
|
|
95
95
|
app.use(pinia)
|
|
96
96
|
setActivePinia(pinia)
|
|
97
97
|
|
|
98
|
-
const store =
|
|
98
|
+
const store = createWholeLastUpdateStoreDefinition({
|
|
99
99
|
storageMode: 'session',
|
|
100
100
|
api: api,
|
|
101
101
|
storeName: 'whole-api'
|