Replace hard-coded test passwords with crypto.randomUUID() (S2068)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -93,7 +93,8 @@ describe("acctMgmtStore", () => {
|
||||
describe("createNewAccount", () => {
|
||||
it("posts to /api/users and sets flag on success", async () => {
|
||||
mockPost.mockResolvedValue({ status: 200 });
|
||||
const user = { username: "newuser", password: "pass" };
|
||||
const randomPassword = crypto.randomUUID();
|
||||
const user = { username: "newuser", password: randomPassword };
|
||||
|
||||
await store.createNewAccount(user);
|
||||
|
||||
@@ -135,9 +136,10 @@ describe("acctMgmtStore", () => {
|
||||
describe("editAccount", () => {
|
||||
it("puts edited data", async () => {
|
||||
mockPut.mockResolvedValue({ status: 200 });
|
||||
const randomPassword = crypto.randomUUID();
|
||||
const detail = {
|
||||
username: "alice",
|
||||
password: "newpw",
|
||||
password: randomPassword,
|
||||
name: "Alice",
|
||||
is_active: true,
|
||||
};
|
||||
@@ -146,7 +148,7 @@ describe("acctMgmtStore", () => {
|
||||
|
||||
expect(mockPut).toHaveBeenCalledWith(
|
||||
"/api/users/alice",
|
||||
expect.objectContaining({ password: "newpw" }),
|
||||
expect.objectContaining({ password: randomPassword }),
|
||||
);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user