Skip to content

Commit abd2103

Browse files
lint
1 parent f1b894c commit abd2103

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

packages/thirdweb/src/wallets/in-app/core/authentication/backend.test.ts

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -10,61 +10,61 @@ vi.mock("../../../../utils/fetch.js");
1010
vi.mock("./getLoginPath.js");
1111

1212
describe("backendAuthenticate", () => {
13-
it("should successfully authenticate and return token", async () => {
14-
// Mock response data
15-
const mockResponse = {
16-
cookieString: "mock-cookie",
17-
token: "mock-token",
18-
};
13+
it("should successfully authenticate and return token", async () => {
14+
// Mock response data
15+
const mockResponse = {
16+
cookieString: "mock-cookie",
17+
token: "mock-token",
18+
};
1919

20-
// Mock fetch implementation
21-
const mockFetch = vi.fn().mockResolvedValue({
22-
json: () => Promise.resolve(mockResponse),
23-
ok: true,
24-
});
20+
// Mock fetch implementation
21+
const mockFetch = vi.fn().mockResolvedValue({
22+
json: () => Promise.resolve(mockResponse),
23+
ok: true,
24+
});
2525

26-
// Mock dependencies
27-
vi.mocked(getClientFetch).mockReturnValue(mockFetch);
28-
vi.mocked(getLoginUrl).mockReturnValue("/auth/login");
26+
// Mock dependencies
27+
vi.mocked(getClientFetch).mockReturnValue(mockFetch);
28+
vi.mocked(getLoginUrl).mockReturnValue("/auth/login");
2929

30-
const result = await backendAuthenticate({
31-
client: TEST_CLIENT,
32-
walletSecret: "test-secret",
33-
});
30+
const result = await backendAuthenticate({
31+
client: TEST_CLIENT,
32+
walletSecret: "test-secret",
33+
});
3434

35-
// Verify the fetch call
36-
expect(mockFetch).toHaveBeenCalledWith("/auth/login", {
37-
body: stringify({ walletSecret: "test-secret" }),
38-
headers: {
39-
"Content-Type": "application/json",
40-
},
41-
method: "POST",
42-
});
35+
// Verify the fetch call
36+
expect(mockFetch).toHaveBeenCalledWith("/auth/login", {
37+
body: stringify({ walletSecret: "test-secret" }),
38+
headers: {
39+
"Content-Type": "application/json",
40+
},
41+
method: "POST",
42+
});
4343

44-
// Verify response
45-
expect(result).toEqual(mockResponse);
46-
});
44+
// Verify response
45+
expect(result).toEqual(mockResponse);
46+
});
4747

48-
it("should throw error when authentication fails", async () => {
49-
// Mock failed fetch response
50-
const mockFetch = vi.fn().mockResolvedValue({
51-
ok: false,
52-
text: () => Promise.resolve("Failed to generate backend account"),
53-
});
48+
it("should throw error when authentication fails", async () => {
49+
// Mock failed fetch response
50+
const mockFetch = vi.fn().mockResolvedValue({
51+
ok: false,
52+
text: () => Promise.resolve("Failed to generate backend account"),
53+
});
5454

55-
// Mock dependencies
56-
vi.mocked(getClientFetch).mockReturnValue(mockFetch);
57-
vi.mocked(getLoginUrl).mockReturnValue("/auth/login");
55+
// Mock dependencies
56+
vi.mocked(getClientFetch).mockReturnValue(mockFetch);
57+
vi.mocked(getLoginUrl).mockReturnValue("/auth/login");
5858

59-
// Test inputs
60-
const args = {
61-
client: TEST_CLIENT,
62-
walletSecret: "test-secret",
63-
};
59+
// Test inputs
60+
const args = {
61+
client: TEST_CLIENT,
62+
walletSecret: "test-secret",
63+
};
6464

65-
// Verify error is thrown
66-
await expect(backendAuthenticate(args)).rejects.toThrow(
67-
"Failed to generate backend account",
68-
);
69-
});
65+
// Verify error is thrown
66+
await expect(backendAuthenticate(args)).rejects.toThrow(
67+
"Failed to generate backend account",
68+
);
69+
});
7070
});

0 commit comments

Comments
 (0)