chore: cleanup fixtures

This commit is contained in:
ndom91 2024-05-06 12:41:05 +02:00
parent 1081ca1c6d
commit 72be19a3f2
No known key found for this signature in database
2 changed files with 8 additions and 16 deletions

View File

@ -1,6 +1,4 @@
// import type { Project } from '$lib/backend/projects' import type { User } from '$lib/stores/user'
// import type { User } from '$lib/stores/user'
// import type { BaseBranch, RemoteCommit, Author, RemoteBranchData } from '$lib/vbranches/types'
export type Constructor<T = any> = new (...args: any[]) => T; export type Constructor<T = any> = new (...args: any[]) => T;
export type Class<T = any> = InstanceType<Constructor<T>>; export type Class<T = any> = InstanceType<Constructor<T>>;
@ -25,11 +23,10 @@ export const project = {
title: "home2021" title: "home2021"
} }
// export const author: Class<Author> = {
export const author = { export const author = {
name: 'John Snow', name: 'John Snow',
email: 'user@company.com', email: 'user@company.com',
gravatarUrl: 'https://gravatar.com/abc123', gravatarUrl: 'https://gravatar.com/avatar/abc123'
} }
export const remoteCommit0 = { export const remoteCommit0 = {
@ -66,8 +63,7 @@ export const baseBranch = {
lastFetchedMs: 1714843209991, lastFetchedMs: 1714843209991,
} }
// export const user: Class<User> = { export const user: User = {
export const user = {
access_token: "c5da8ec0-2a2e-4f1c-a796-686c5606e566", access_token: "c5da8ec0-2a2e-4f1c-a796-686c5606e566",
created_at: "2024-05-04T13:27:30Z", created_at: "2024-05-04T13:27:30Z",
email: "yo@ndo.dev", email: "yo@ndo.dev",
@ -81,9 +77,9 @@ export const user = {
picture: "https://source.boringavatar.com/marble/120", picture: "https://source.boringavatar.com/marble/120",
role: undefined, role: undefined,
updated_at: "2024-05-05T15:38:02Z", updated_at: "2024-05-05T15:38:02Z",
supporter: false
} }
// export const remoteBranchData: Class<RemoteBranchData> = {
export const remoteBranchData = { export const remoteBranchData = {
sha: '90c225edcc74b31718a9cd8963c1bc89c17d8864', sha: '90c225edcc74b31718a9cd8963c1bc89c17d8864',
name: 'test', name: 'test',

View File

@ -3,25 +3,23 @@ import { mockIPC } from "@tauri-apps/api/mocks";
import { mockWindows } from '@tauri-apps/api/mocks'; import { mockWindows } from '@tauri-apps/api/mocks';
export function mockTauri() { export function mockTauri() {
mockWindows('main');
mockIPC((cmd, args) => { mockIPC((cmd, args) => {
console.log("MOCKIPC.CMD", cmd, args) console.log(`%c${cmd}`, 'background: #222; color: #4db2ad', args)
// Open Project Dialog // @ts-expect-error 'message' is dynamic
if (cmd === "tauri" && args.__tauriModule === "Dialog" && args.message?.cmd === "openDialog") { if (cmd === "tauri" && args.message?.cmd === "openDialog") {
return "/Users/user/project" return "/Users/user/project"
} }
// List Projects
if (cmd === "list_projects") { if (cmd === "list_projects") {
return [project] return [project]
} }
// List Project
if (cmd === "get_project" && args.id === "ac44a3bb-8bbb-4af9-b8c9-7950dd9ec295") { if (cmd === "get_project" && args.id === "ac44a3bb-8bbb-4af9-b8c9-7950dd9ec295") {
return project return project
} }
// Get HEAD
if (cmd === "git_head") { if (cmd === "git_head") {
return "refs/heads/gitbutler/integration" return "refs/heads/gitbutler/integration"
} }
@ -58,6 +56,4 @@ export function mockTauri() {
return user return user
} }
}); });
mockWindows('main');
} }