@@ -146,100 +146,6 @@ describe("lastUsedIdentitiesStore", () => {
146146 lastUsedIdentitiesStore . reset ( ) ;
147147 expect ( get ( lastUsedIdentitiesStore ) . identities ) . toEqual ( { } ) ;
148148 } ) ;
149-
150- describe ( "updateLastUsedIdentity" , ( ) => {
151- const newName = "Updated Name" ;
152- const newCredId = strToUint8Array ( "new-cred-id" ) ;
153- const newAuthMethod = { passkey : { credentialId : newCredId } } ;
154- const newCreatedAtMillis = 1695000000000 ;
155-
156- beforeEach ( ( ) => {
157- // Add an identity to be updated
158- lastUsedIdentitiesStore . addLastUsedIdentity ( {
159- identityNumber : identity1 ,
160- name : name1 ,
161- authMethod : { passkey : { credentialId : credId1 } } ,
162- } ) ;
163- } ) ;
164-
165- it ( "should not update if the identity does not exist" , ( ) => {
166- const nonExistentIdentity = BigInt ( "999" ) ;
167- const originalState = get ( lastUsedIdentitiesStore ) . identities ;
168-
169- lastUsedIdentitiesStore . updateLastUsedIdentity ( nonExistentIdentity , {
170- name : "A New Name" ,
171- } ) ;
172-
173- expect ( get ( lastUsedIdentitiesStore ) . identities ) . toEqual ( originalState ) ;
174- } ) ;
175-
176- it ( "should update only the name of an existing identity" , ( ) => {
177- lastUsedIdentitiesStore . updateLastUsedIdentity ( identity1 , {
178- name : newName ,
179- } ) ;
180-
181- const updatedIdentity = get ( lastUsedIdentitiesStore ) . identities [
182- identity1 . toString ( )
183- ] ;
184- expect ( updatedIdentity . name ) . toBe ( newName ) ;
185- expect ( updatedIdentity . authMethod ) . toEqual ( {
186- passkey : { credentialId : credId1 } ,
187- } ) ;
188- expect ( updatedIdentity . lastUsedTimestampMillis ) . toBe ( mockTimestamp1 ) ;
189- } ) ;
190-
191- it ( "should update only the authMethod of an existing identity" , ( ) => {
192- lastUsedIdentitiesStore . updateLastUsedIdentity ( identity1 , {
193- authMethod : newAuthMethod ,
194- } ) ;
195-
196- const updatedIdentity = get ( lastUsedIdentitiesStore ) . identities [
197- identity1 . toString ( )
198- ] ;
199- expect ( updatedIdentity . name ) . toBe ( name1 ) ;
200- expect ( updatedIdentity . authMethod ) . toEqual ( newAuthMethod ) ;
201- expect ( updatedIdentity . lastUsedTimestampMillis ) . toBe ( mockTimestamp1 ) ;
202- } ) ;
203-
204- it ( "should update only the createdAtMillis of an existing identity" , ( ) => {
205- lastUsedIdentitiesStore . updateLastUsedIdentity ( identity1 , {
206- createdAtMillis : newCreatedAtMillis ,
207- } ) ;
208-
209- const updatedIdentity = get ( lastUsedIdentitiesStore ) . identities [
210- identity1 . toString ( )
211- ] ;
212- expect ( updatedIdentity . createdAtMillis ) . toBe ( newCreatedAtMillis ) ;
213- expect ( updatedIdentity . name ) . toBe ( name1 ) ;
214- expect ( updatedIdentity . lastUsedTimestampMillis ) . toBe ( mockTimestamp1 ) ;
215- } ) ;
216-
217- it ( "should update multiple properties at once" , ( ) => {
218- lastUsedIdentitiesStore . updateLastUsedIdentity ( identity1 , {
219- name : newName ,
220- authMethod : newAuthMethod ,
221- } ) ;
222-
223- const updatedIdentity = get ( lastUsedIdentitiesStore ) . identities [
224- identity1 . toString ( )
225- ] ;
226- expect ( updatedIdentity . name ) . toBe ( newName ) ;
227- expect ( updatedIdentity . authMethod ) . toEqual ( newAuthMethod ) ;
228- expect ( updatedIdentity . lastUsedTimestampMillis ) . toBe ( mockTimestamp1 ) ;
229- } ) ;
230-
231- it ( "should not update the lastUsedTimestampMillis" , ( ) => {
232- vi . setSystemTime ( mockTimestamp2 ) ;
233- lastUsedIdentitiesStore . updateLastUsedIdentity ( identity1 , {
234- name : newName ,
235- } ) ;
236-
237- const updatedIdentity = get ( lastUsedIdentitiesStore ) . identities [
238- identity1 . toString ( )
239- ] ;
240- expect ( updatedIdentity . lastUsedTimestampMillis ) . toBe ( mockTimestamp1 ) ;
241- } ) ;
242- } ) ;
243149} ) ;
244150
245151describe ( "lastUsedIdentityStore (derived store)" , ( ) => {
0 commit comments