mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[deps] Autofill: Update prettier to v3 (#7014)
* [deps] Autofill: Update prettier to v3 * prettier formatting updates --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jonathan Prusik <jprusik@classynemesis.com>
This commit is contained in:
@@ -22,7 +22,7 @@ export class FakeGlobalStateProvider implements GlobalStateProvider {
|
||||
|
||||
getFake<T>(keyDefinition: KeyDefinition<T>): FakeGlobalState<T> {
|
||||
const key = Array.from(this.states.keys()).find(
|
||||
(k) => k.stateDefinition === keyDefinition.stateDefinition && k.key === keyDefinition.key
|
||||
(k) => k.stateDefinition === keyDefinition.stateDefinition && k.key === keyDefinition.key,
|
||||
);
|
||||
return this.get(key) as FakeGlobalState<T>;
|
||||
}
|
||||
@@ -42,7 +42,7 @@ export class FakeUserStateProvider implements UserStateProvider {
|
||||
|
||||
getFake<T>(keyDefinition: KeyDefinition<T>): FakeUserState<T> {
|
||||
const key = Array.from(this.states.keys()).find(
|
||||
(k) => k.stateDefinition === keyDefinition.stateDefinition && k.key === keyDefinition.key
|
||||
(k) => k.stateDefinition === keyDefinition.stateDefinition && k.key === keyDefinition.key,
|
||||
);
|
||||
return this.get(key) as FakeUserState<T>;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ const DEFAULT_TEST_OPTIONS: StateUpdateOptions<any, any> = {
|
||||
};
|
||||
|
||||
function populateOptionsWithDefault(
|
||||
options: StateUpdateOptions<any, any>
|
||||
options: StateUpdateOptions<any, any>,
|
||||
): StateUpdateOptions<any, any> {
|
||||
return {
|
||||
...DEFAULT_TEST_OPTIONS,
|
||||
@@ -26,13 +26,13 @@ export class FakeGlobalState<T> implements GlobalState<T> {
|
||||
|
||||
update: <TCombine>(
|
||||
configureState: (state: T, dependency: TCombine) => T,
|
||||
options?: StateUpdateOptions<T, TCombine>
|
||||
options?: StateUpdateOptions<T, TCombine>,
|
||||
) => Promise<T> = jest.fn(async (configureState, options) => {
|
||||
options = populateOptionsWithDefault(options);
|
||||
if (this.stateSubject["_buffer"].length == 0) {
|
||||
// throw a more helpful not initialized error
|
||||
throw new Error(
|
||||
"You must initialize the state with a value before calling update. Try calling `stateSubject.next(initialState)` before calling update"
|
||||
"You must initialize the state with a value before calling update. Try calling `stateSubject.next(initialState)` before calling update",
|
||||
);
|
||||
}
|
||||
const current = await firstValueFrom(this.state$.pipe(timeout(100)));
|
||||
@@ -61,7 +61,7 @@ export class FakeUserState<T> implements UserState<T> {
|
||||
|
||||
update: <TCombine>(
|
||||
configureState: (state: T, dependency: TCombine) => T,
|
||||
options?: StateUpdateOptions<T, TCombine>
|
||||
options?: StateUpdateOptions<T, TCombine>,
|
||||
) => Promise<T> = jest.fn(async (configureState, options) => {
|
||||
options = populateOptionsWithDefault(options);
|
||||
const current = await firstValueFrom(this.state$.pipe(timeout(options.msTimeout)));
|
||||
@@ -82,11 +82,11 @@ export class FakeUserState<T> implements UserState<T> {
|
||||
updateFor: <TCombine>(
|
||||
userId: UserId,
|
||||
configureState: (state: T, dependency: TCombine) => T,
|
||||
options?: StateUpdateOptions<T, TCombine>
|
||||
options?: StateUpdateOptions<T, TCombine>,
|
||||
) => Promise<T> = jest.fn();
|
||||
|
||||
createDerived: <TTo>(
|
||||
converter: (data: T, context: any) => Promise<TTo>
|
||||
converter: (data: T, context: any) => Promise<TTo>,
|
||||
) => DerivedUserState<TTo> = jest.fn();
|
||||
|
||||
getFromState: () => Promise<T> = jest.fn(async () => {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
export const toEqualBuffer: jest.CustomMatcher = function (
|
||||
received: ArrayBuffer | Uint8Array,
|
||||
expected: ArrayBuffer | Uint8Array
|
||||
expected: ArrayBuffer | Uint8Array,
|
||||
) {
|
||||
received = new Uint8Array(received);
|
||||
expected = new Uint8Array(expected);
|
||||
|
||||
@@ -17,7 +17,7 @@ export function GetUniqueString(prefix = "") {
|
||||
|
||||
export function BuildTestObject<T, K extends keyof T = keyof T>(
|
||||
def: Partial<Pick<T, K>> | T,
|
||||
constructor?: new () => T
|
||||
constructor?: new () => T,
|
||||
): T {
|
||||
return Object.assign(constructor === null ? {} : new constructor(), def) as T;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user