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 { BaseBranch, RemoteCommit, Author, RemoteBranchData } from '$lib/vbranches/types'
import type { User } from '$lib/stores/user'
export type Constructor<T = any> = new (...args: any[]) => T;
export type Class<T = any> = InstanceType<Constructor<T>>;
@ -25,11 +23,10 @@ export const project = {
title: "home2021"
}
// export const author: Class<Author> = {
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<User> = {
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<RemoteBranchData> = {
export const remoteBranchData = {
sha: '90c225edcc74b31718a9cd8963c1bc89c17d8864',
name: 'test',

View File

@ -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');
}