test(ui): i corrected UI Testing
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { Actions, redirect } from "@sveltejs/kit";
|
||||
import { optima } from "$lib";
|
||||
import { INTERNAL_API_URL } from "$env/static/private";
|
||||
|
||||
export const actions: Actions = {
|
||||
login: async (event) => {
|
||||
@@ -8,7 +7,6 @@ export const actions: Actions = {
|
||||
|
||||
const tokens = await optima.user.awaitAuthCallback(
|
||||
data.get("callbackKey") as string,
|
||||
INTERNAL_API_URL,
|
||||
);
|
||||
|
||||
event.cookies.set("accessToken", tokens.accessToken, {
|
||||
|
||||
@@ -90,6 +90,7 @@ describe("admin/users +page.server.ts", () => {
|
||||
return {
|
||||
get: (key: string) => entries[key] ?? null,
|
||||
getAll: (key: string) => (entries[key] ? [entries[key]] : []),
|
||||
has: (key: string) => key in entries,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ const { mockOptima, mockCheckPermissions, mockHandleApiError } = vi.hoisted(
|
||||
sales: {
|
||||
fetchOne: vi.fn(),
|
||||
fetchWorkflowStatus: vi.fn(),
|
||||
fetchOpportunityTypes: vi.fn(),
|
||||
},
|
||||
},
|
||||
mockCheckPermissions: vi.fn(),
|
||||
@@ -34,6 +35,7 @@ describe("sales/opportunity/[id] +page.server.ts load", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
vi.spyOn(console, "error").mockImplementation(() => {});
|
||||
mockOptima.sales.fetchOpportunityTypes.mockResolvedValue({ data: [] });
|
||||
});
|
||||
|
||||
it("returns empty data when no token", async () => {
|
||||
|
||||
Reference in New Issue
Block a user