1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-22 16:29:09 +01:00

Update Expectations of update method (#7119)

* Update Expectations of `update` method

Change `update` to return current state
when `shouldUpdate` returns false.

* Delete Accidental Tests
This commit is contained in:
Justin Baur 2023-12-06 14:14:49 -05:00 committed by GitHub
parent 6ddf87bc72
commit c3e114e36f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 8 additions and 8 deletions

View File

@ -48,7 +48,7 @@ export class FakeGlobalState<T> implements GlobalState<T> {
? await firstValueFrom(options.combineLatestWith.pipe(timeout(options.msTimeout)))
: null;
if (!options.shouldUpdate(current, combinedDependencies)) {
return;
return current;
}
const newState = configureState(current, combinedDependencies);
this.stateSubject.next(newState);
@ -77,7 +77,7 @@ export class FakeUserState<T> implements UserState<T> {
? await firstValueFrom(options.combineLatestWith.pipe(timeout(options.msTimeout)))
: null;
if (!options.shouldUpdate(current, combinedDependencies)) {
return;
return current;
}
const newState = configureState(current, combinedDependencies);
this.stateSubject.next(newState);

View File

@ -301,7 +301,7 @@ describe("DefaultActiveUserState", () => {
await awaitAsync();
expect(diskStorageService.mock.save).not.toHaveBeenCalled();
expect(result).toBe(undefined);
expect(result).toBeNull();
expect(emissions).toEqual([null]);
});

View File

@ -122,7 +122,7 @@ export class DefaultActiveUserState<T> implements ActiveUserState<T> {
: null;
if (!options.shouldUpdate(currentState, combinedDependencies)) {
return;
return currentState;
}
const newState = configureState(currentState, combinedDependencies);

View File

@ -145,7 +145,7 @@ describe("DefaultGlobalState", () => {
expect(diskStorageService.mock.save).not.toHaveBeenCalled();
expect(emissions).toEqual([null]); // Initial value
expect(result).toBeUndefined();
expect(result).toBeNull();
});
it("should provide the update callback with the current State", async () => {

View File

@ -85,7 +85,7 @@ export class DefaultGlobalState<T> implements GlobalState<T> {
: null;
if (!options.shouldUpdate(currentState, combinedDependencies)) {
return;
return currentState;
}
const newState = configureState(currentState, combinedDependencies);

View File

@ -156,7 +156,7 @@ describe("DefaultSingleUserState", () => {
expect(diskStorageService.mock.save).not.toHaveBeenCalled();
expect(emissions).toEqual([null]); // Initial value
expect(result).toBeUndefined();
expect(result).toBeNull();
});
it("should provide the update callback with the current State", async () => {

View File

@ -91,7 +91,7 @@ export class DefaultSingleUserState<T> implements SingleUserState<T> {
: null;
if (!options.shouldUpdate(currentState, combinedDependencies)) {
return;
return currentState;
}
const newState = configureState(currentState, combinedDependencies);