Skip to content

Commit

Permalink
Update to mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
amddg44 committed Mar 18, 2024
1 parent 8065510 commit a1d021b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions DuckDuckGoTests/MockSecureVault.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ final class MockSecureVault<T: AutofillDatabaseProvider>: AutofillSecureVault {
return accountID
}

func updateLastUsedFor(accountId: Int64) throws {
if var account = storedAccounts.first(where: { $0.id == String(accountId) }) {
account.lastUsed = Date()
}
}

func deleteWebsiteCredentialsFor(accountId: Int64) throws {
storedCredentials[accountId] = nil
}
Expand Down Expand Up @@ -274,6 +280,12 @@ class MockDatabaseProvider: AutofillDatabaseProvider {
return _accounts
}

func updateLastUsedForAccountId(_ accountId: Int64) throws {
if var account = _accounts.first(where: { $0.id == String(accountId) }) {
account.lastUsed = Date()
}
}

func deleteWebsiteCredentialsForAccountId(_ accountId: Int64) throws {
self._accounts = self._accounts.filter { $0.id != String(accountId) }
}
Expand Down

0 comments on commit a1d021b

Please sign in to comment.