1
1
import assert from 'assert' ;
2
- import { before } from 'mocha' ;
3
- import { v4 as uuidv4 } from 'uuid' ;
4
2
5
3
import StorageController , {
6
4
StorageVariables ,
@@ -45,7 +43,7 @@ suite('Storage Controller Test Suite', () => {
45
43
) ;
46
44
} ) ;
47
45
48
- suite ( 'for a new user that does not have anonymousId or userId ' , ( ) => {
46
+ suite ( 'for a new user that does not have anonymousId' , ( ) => {
49
47
const extensionContextStub = new ExtensionContextStub ( ) ;
50
48
extensionContextStub . _globalState = { } ;
51
49
const testStorageController = new StorageController ( extensionContextStub ) ;
@@ -55,34 +53,7 @@ suite('Storage Controller Test Suite', () => {
55
53
const anonymousId = testStorageController . get (
56
54
StorageVariables . GLOBAL_ANONYMOUS_ID
57
55
) ;
58
- const userId = testStorageController . get ( StorageVariables . GLOBAL_USER_ID ) ;
59
56
assert . deepStrictEqual ( userIdentity , { anonymousId } ) ;
60
- assert ( ! userId ) ;
61
- } ) ;
62
- } ) ;
63
-
64
- suite ( 'for an old user that does not have anonymousId but has userId' , ( ) => {
65
- const extensionContextStub = new ExtensionContextStub ( ) ;
66
- extensionContextStub . _globalState = { } ;
67
- const testStorageController = new StorageController ( extensionContextStub ) ;
68
- const id = uuidv4 ( ) ;
69
-
70
- before ( async ( ) => {
71
- await testStorageController . update (
72
- StorageVariables . GLOBAL_USER_ID ,
73
- id ,
74
- StorageLocation . GLOBAL
75
- ) ;
76
- } ) ;
77
-
78
- test ( 'getUserIdentity returns userId from the global storage and returns it to telemetry' , ( ) => {
79
- const userIdentity = testStorageController . getUserIdentity ( ) ;
80
- const anonymousId = testStorageController . get (
81
- StorageVariables . GLOBAL_ANONYMOUS_ID
82
- ) ;
83
- const userId = testStorageController . get ( StorageVariables . GLOBAL_USER_ID ) ;
84
- assert ( userId === id ) ;
85
- assert . deepStrictEqual ( userIdentity , { userId, anonymousId } ) ;
86
57
} ) ;
87
58
} ) ;
88
59
} ) ;
0 commit comments