diff options
Diffstat (limited to 'packages/shared/src/stores/__tests__/ServiceBase.test.ts')
-rw-r--r-- | packages/shared/src/stores/__tests__/ServiceBase.test.ts | 46 |
1 files changed, 7 insertions, 39 deletions
diff --git a/packages/shared/src/stores/__tests__/ServiceBase.test.ts b/packages/shared/src/stores/__tests__/ServiceBase.test.ts index e2b0aa9..2fc9cbc 100644 --- a/packages/shared/src/stores/__tests__/ServiceBase.test.ts +++ b/packages/shared/src/stores/__tests__/ServiceBase.test.ts | |||
@@ -20,49 +20,15 @@ | |||
20 | 20 | ||
21 | import type { SnapshotIn } from 'mobx-state-tree'; | 21 | import type { SnapshotIn } from 'mobx-state-tree'; |
22 | 22 | ||
23 | import Certificate from '../Certificate.js'; | ||
24 | import Profile from '../Profile.js'; | ||
25 | import ServiceBase, { SecurityLabelKind } from '../ServiceBase.js'; | 23 | import ServiceBase, { SecurityLabelKind } from '../ServiceBase.js'; |
26 | import type { ServiceStateSnapshotIn } from '../ServiceState.js'; | 24 | import type { ServiceStateSnapshotIn } from '../ServiceState.js'; |
27 | import SharedStoreBase from '../SharedStoreBase.js'; | 25 | import SharedStoreBase from '../SharedStoreBase.js'; |
28 | 26 | ||
29 | const testProfile: SnapshotIn<typeof Profile> = { | 27 | import { |
30 | id: 'testProfile', | 28 | testCertificate, |
31 | settings: { | 29 | testProfile, |
32 | name: 'test profile', | 30 | testService, |
33 | }, | 31 | } from './__fixtures__/serviceFixtures.js'; |
34 | }; | ||
35 | |||
36 | const testService: SnapshotIn<typeof ServiceBase> = { | ||
37 | id: 'testService', | ||
38 | settings: { | ||
39 | name: 'testService', | ||
40 | url: 'https://example.org', | ||
41 | profile: 'testProfile', | ||
42 | }, | ||
43 | }; | ||
44 | |||
45 | const testCertificate: SnapshotIn<typeof Certificate> = { | ||
46 | data: '-----TEST DATA-----', | ||
47 | issuer: { | ||
48 | commonName: 'Test issuer', | ||
49 | country: '', | ||
50 | state: '', | ||
51 | locality: '', | ||
52 | }, | ||
53 | issuerName: 'Test issuer', | ||
54 | subject: { | ||
55 | commonName: 'Test subject', | ||
56 | country: '', | ||
57 | state: '', | ||
58 | locality: '', | ||
59 | }, | ||
60 | subjectName: 'Test subject', | ||
61 | serialNumber: '123456', | ||
62 | validStart: 1_653_551_516, | ||
63 | validExpiry: 1_685_087_516, | ||
64 | fingerprint: 'sha256/KUIHdVkSTzYmb2PGMotOPDm2ir52G1QyPW6rt6wUjZ0=', | ||
65 | }; | ||
66 | 32 | ||
67 | function createTestService( | 33 | function createTestService( |
68 | snapshot: Partial<SnapshotIn<typeof ServiceBase>>, | 34 | snapshot: Partial<SnapshotIn<typeof ServiceBase>>, |
@@ -166,6 +132,7 @@ test.each([ | |||
166 | const service = createTestService({ currentUrl: url }); | 132 | const service = createTestService({ currentUrl: url }); |
167 | 133 | ||
168 | expect(service.securityLabel).toBe(labelKind); | 134 | expect(service.securityLabel).toBe(labelKind); |
135 | expect(service.hasSecurityLabelWarning).toBe(hasWarning); | ||
169 | expect(service.alwaysShowLocationBar).toBe(hasWarning); | 136 | expect(service.alwaysShowLocationBar).toBe(hasWarning); |
170 | }, | 137 | }, |
171 | ); | 138 | ); |
@@ -181,5 +148,6 @@ test('shows a certificate error warning if there is a certificate error', () => | |||
181 | }); | 148 | }); |
182 | 149 | ||
183 | expect(service.securityLabel).toBe(SecurityLabelKind.CertificateError); | 150 | expect(service.securityLabel).toBe(SecurityLabelKind.CertificateError); |
151 | expect(service.hasSecurityLabelWarning).toBe(true); | ||
184 | expect(service.alwaysShowLocationBar).toBe(true); | 152 | expect(service.alwaysShowLocationBar).toBe(true); |
185 | }); | 153 | }); |