From 72be19a3f211a80bd08a2fd7d1f2885de23be8c4 Mon Sep 17 00:00:00 2001 From: ndom91 Date: Mon, 6 May 2024 12:41:05 +0200 Subject: [PATCH] chore: cleanup fixtures --- app/src/lib/testing/fixtures.ts | 12 ++++-------- app/src/lib/testing/index.ts | 12 ++++-------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/app/src/lib/testing/fixtures.ts b/app/src/lib/testing/fixtures.ts index e78f0e1e4..be9124a07 100644 --- a/app/src/lib/testing/fixtures.ts +++ b/app/src/lib/testing/fixtures.ts @@ -1,6 +1,4 @@ -// import type { Project } from '$lib/backend/projects' -// import type { User } from '$lib/stores/user' -// import type { BaseBranch, RemoteCommit, Author, RemoteBranchData } from '$lib/vbranches/types' +import type { User } from '$lib/stores/user' export type Constructor = new (...args: any[]) => T; export type Class = InstanceType>; @@ -25,11 +23,10 @@ export const project = { title: "home2021" } -// export const author: Class = { export const author = { name: 'John Snow', email: 'user@company.com', - gravatarUrl: 'https://gravatar.com/abc123', + gravatarUrl: 'https://gravatar.com/avatar/abc123' } export const remoteCommit0 = { @@ -66,8 +63,7 @@ export const baseBranch = { lastFetchedMs: 1714843209991, } -// export const user: Class = { -export const user = { +export const user: User = { access_token: "c5da8ec0-2a2e-4f1c-a796-686c5606e566", created_at: "2024-05-04T13:27:30Z", email: "yo@ndo.dev", @@ -81,9 +77,9 @@ export const user = { picture: "https://source.boringavatar.com/marble/120", role: undefined, updated_at: "2024-05-05T15:38:02Z", + supporter: false } -// export const remoteBranchData: Class = { export const remoteBranchData = { sha: '90c225edcc74b31718a9cd8963c1bc89c17d8864', name: 'test', diff --git a/app/src/lib/testing/index.ts b/app/src/lib/testing/index.ts index 1afcd0529..ebc239ebd 100644 --- a/app/src/lib/testing/index.ts +++ b/app/src/lib/testing/index.ts @@ -3,25 +3,23 @@ import { mockIPC } from "@tauri-apps/api/mocks"; import { mockWindows } from '@tauri-apps/api/mocks'; export function mockTauri() { + mockWindows('main'); mockIPC((cmd, args) => { - console.log("MOCKIPC.CMD", cmd, args) + console.log(`%c${cmd}`, 'background: #222; color: #4db2ad', args) - // Open Project Dialog - if (cmd === "tauri" && args.__tauriModule === "Dialog" && args.message?.cmd === "openDialog") { + // @ts-expect-error 'message' is dynamic + if (cmd === "tauri" && args.message?.cmd === "openDialog") { return "/Users/user/project" } - // List Projects if (cmd === "list_projects") { return [project] } - // List Project if (cmd === "get_project" && args.id === "ac44a3bb-8bbb-4af9-b8c9-7950dd9ec295") { return project } - // Get HEAD if (cmd === "git_head") { return "refs/heads/gitbutler/integration" } @@ -58,6 +56,4 @@ export function mockTauri() { return user } }); - mockWindows('main'); - }