1
0
mirror of https://github.com/bitwarden/browser synced 2026-03-02 11:31:44 +00:00

[PM-27086] Changing direction: remove new methods

This commit is contained in:
rr-bw
2026-01-13 12:56:08 -08:00
parent acc6117990
commit bfbaa2d6f0
8 changed files with 2 additions and 987 deletions

View File

@@ -2,9 +2,7 @@ import { MockProxy, mock } from "jest-mock-extended";
import { BehaviorSubject, of } from "rxjs";
import { OrganizationUserApiService } from "@bitwarden/admin-console/common";
import { DefaultSetInitialPasswordService } from "@bitwarden/angular/auth/password-management/set-initial-password/default-set-initial-password.service.implementation";
import {
SetInitialPasswordCredentials,
SetInitialPasswordCredentialsOld,
SetInitialPasswordService,
SetInitialPasswordUserType,
@@ -21,7 +19,6 @@ import { AccountCryptographicStateService } from "@bitwarden/common/key-manageme
import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service";
import { EncString } from "@bitwarden/common/key-management/crypto/models/enc-string";
import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/key-management/master-password/abstractions/master-password.service.abstraction";
import { MasterPasswordSalt } from "@bitwarden/common/key-management/master-password/types/master-password.types";
import { KeysRequest } from "@bitwarden/common/models/request/keys.request";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
@@ -185,57 +182,4 @@ describe("DesktopSetInitialPasswordService", () => {
});
});
});
describe("setInitialPassword()", () => {
let credentials: SetInitialPasswordCredentials;
let userType: SetInitialPasswordUserType;
let userId: UserId;
beforeEach(() => {
credentials = {
newPassword: "newPassword",
newPasswordHint: "newPasswordHint",
kdfConfig: DEFAULT_KDF_CONFIG,
salt: "salt" as MasterPasswordSalt,
orgSsoIdentifier: "orgSsoIdentifier",
orgId: "orgId",
resetPasswordAutoEnroll: false,
};
userId = "userId" as UserId;
userType = SetInitialPasswordUserType.JIT_PROVISIONED_MP_ORG_USER;
});
describe("given the initial password was successfully set", () => {
it("should send a 'redrawMenu' message", async () => {
// Arrange
jest
.spyOn(DefaultSetInitialPasswordService.prototype, "setInitialPassword")
.mockResolvedValue(undefined);
// Act
await sut.setInitialPassword(credentials, userType, userId);
// Assert
expect(messagingService.send).toHaveBeenCalledTimes(1);
expect(messagingService.send).toHaveBeenCalledWith("redrawMenu");
});
});
describe("given the initial password was NOT successfully set (due to parent method failure)", () => {
it("should NOT send a 'redrawMenu' message", async () => {
// Arrange
const parentError = new Error("Parent setInitialPassword failed");
jest
.spyOn(DefaultSetInitialPasswordService.prototype, "setInitialPassword")
.mockRejectedValue(parentError);
// Act
const promise = sut.setInitialPassword(credentials, userType, userId);
// Assert
await expect(promise).rejects.toThrow(parentError);
expect(messagingService.send).not.toHaveBeenCalled();
});
});
});
});

View File

@@ -1,7 +1,6 @@
import { OrganizationUserApiService } from "@bitwarden/admin-console/common";
import { DefaultSetInitialPasswordService } from "@bitwarden/angular/auth/password-management/set-initial-password/default-set-initial-password.service.implementation";
import {
SetInitialPasswordCredentials,
SetInitialPasswordCredentialsOld,
SetInitialPasswordService,
SetInitialPasswordUserType,
@@ -63,14 +62,4 @@ export class DesktopSetInitialPasswordService
this.messagingService.send("redrawMenu");
}
override async setInitialPassword(
credentials: SetInitialPasswordCredentials,
userType: SetInitialPasswordUserType,
userId: UserId,
) {
await super.setInitialPassword(credentials, userType, userId);
this.messagingService.send("redrawMenu");
}
}