old-remnantchat/src/test-utils/stubs/settingsContext.ts
Jeremy Kahn 94a4b2fb2e
refactor(services): Standardize services and lib organization (#226)
* refactor(Notification): use instance methods
* refactor(Audio): move to lib layer
* refactor(EncryptionService): rename instance to encryption
* refactor(ConnectionTest): move to lib
* refactor(FileTransfer): move to lib
* refactor(PeerRoom): move to lib
* refactor(sleep): move to lib
* refactor(type-guards): move to lib
* refactor(SerializationService): use standard instance name
* refactor(SettingsService): use standard instance name
2024-01-28 20:46:59 -06:00

25 lines
759 B
TypeScript

import { SettingsContextProps } from 'contexts/SettingsContext'
import { ColorMode, UserSettings } from 'models/settings'
import { encryption } from 'services/Encryption'
export const userSettingsContextStubFactory = (
userSettingsOverrides: Partial<UserSettings> = {}
) => {
const userSettingsStub: SettingsContextProps = {
updateUserSettings: () => Promise.resolve(),
getUserSettings: () => ({
userId: '',
customUsername: '',
colorMode: ColorMode.DARK,
playSoundOnNewMessage: true,
showNotificationOnNewMessage: true,
showActiveTypingStatus: true,
publicKey: encryption.cryptoKeyStub,
privateKey: encryption.cryptoKeyStub,
...userSettingsOverrides,
}),
}
return userSettingsStub
}