chore: prettier

This commit is contained in:
ndom91 2024-05-06 13:06:13 +02:00
parent 80f517b13b
commit a6968438a2
No known key found for this signature in database
8 changed files with 284 additions and 285 deletions

View File

@ -9,7 +9,7 @@ test('has empty title', async ({ page }) => {
test('has text package.json', async ({ page }) => {
await page.goto('http://localhost:1420');
const listBox = page.getByRole('listbox').getByRole('button')
const listBox = page.getByRole('listbox').getByRole('button');
await expect(listBox).toHaveText('package.json');
})
});

View File

@ -13,13 +13,13 @@ export default defineConfig({
}
],
expect: {
timeout: 20 * 1000,
timeout: 20 * 1000
},
use: {
trace: 'retain-on-failure',
trace: 'retain-on-failure'
},
webServer: {
command: 'pnpm test:e2e:run',
url: 'http://localhost:1420',
url: 'http://localhost:1420'
}
});

View File

@ -1,6 +1,5 @@
<!doctype html>
<html lang="en">
<head>
<script src="http://localhost:9222/scripts/launcher.js" data-origin="debugger"></script>
@ -12,5 +11,4 @@
<body class="text-base">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>

View File

@ -1,4 +1,4 @@
import type { User } from '$lib/stores/user'
import type { User } from '$lib/stores/user';
export type Constructor<T = any> = new (...args: any[]) => T;
export type Class<T = any> = InstanceType<Constructor<T>>;
@ -8,11 +8,11 @@ export const project = {
description: null,
gitbutler_code_push_state: null,
gitbutler_data_last_fetch: null,
id: "ac44a3bb-8bbb-4af9-b8c9-7950dd9ec295",
id: 'ac44a3bb-8bbb-4af9-b8c9-7950dd9ec295',
ok_with_force_push: true,
omit_certificate_check: null,
path: "/opt/ndomino/home2021",
preferred_key: "systemExecutable",
path: '/opt/ndomino/home2021',
preferred_key: 'systemExecutable',
project_data_last_fetch: Object,
fetched: {
timestamp: {
@ -20,28 +20,28 @@ export const project = {
secs_since_epoch: 1714924416
}
},
title: "home2021"
}
title: 'home2021'
};
export const author = {
name: 'John Snow',
email: 'user@company.com',
gravatarUrl: 'https://gravatar.com/avatar/abc123'
}
};
export const remoteCommit0 = {
id: 'fe30876278739f7182effd27e9d9debde648b4de',
author,
description: 'fix: updated files',
createdAt: 1714902366,
}
createdAt: 1714902366
};
export const remoteCommit1 = {
id: 'fe30876278739f7182effd27e9d9debde648b4dd',
author,
description: 'fix: updated files',
createdAt: 1714902366,
}
createdAt: 1714902366
};
export const remoteBranch0 = {
sha: '90c225edcc74b31718a9cd8963c1bc89c17d8863',
@ -49,7 +49,7 @@ export const remoteBranch0 = {
upstream: '',
lastCommitTimestampMs: 1714902366140,
lastCommitAuthor: 'John Snow'
}
};
export const baseBranch = {
branchName: 'origin/gitbutler/integration',
@ -60,25 +60,25 @@ export const baseBranch = {
behind: 0,
upstreamCommits: [],
recentCommits: [remoteCommit0],
lastFetchedMs: 1714843209991,
}
lastFetchedMs: 1714843209991
};
export const user: User = {
access_token: "c5da8ec0-2a2e-4f1c-a796-686c5606e566",
created_at: "2024-05-04T13:27:30Z",
email: "yo@ndo.dev",
access_token: 'c5da8ec0-2a2e-4f1c-a796-686c5606e566',
created_at: '2024-05-04T13:27:30Z',
email: 'yo@ndo.dev',
family_name: undefined,
github_access_token: undefined,
github_username: undefined,
given_name: undefined,
id: 31,
locale: "en_US",
name: "Nico",
picture: "https://source.boringavatar.com/marble/120",
locale: 'en_US',
name: 'Nico',
picture: 'https://source.boringavatar.com/marble/120',
role: undefined,
updated_at: "2024-05-05T15:38:02Z",
updated_at: '2024-05-05T15:38:02Z',
supporter: false
}
};
export const remoteBranchData = {
sha: '90c225edcc74b31718a9cd8963c1bc89c17d8864',
@ -91,12 +91,12 @@ export const remoteBranchData = {
ahead: 0,
behind: 0,
commits: [remoteCommit0],
isMergeable: true,
}
isMergeable: true
};
export const fileHunk = {
binary: false,
changeType: "modified",
changeType: 'modified',
diff: `
@@ -63,7 +63,7 @@
"simple-git-hooks": "^2.11.1",
@ -109,25 +109,25 @@ export const fileHunk = {
"extends": [
`,
end: 70,
filePath: "package.json",
hash: "dc79c984a36b2f8a29007633bde4daf3",
id: "63-70",
filePath: 'package.json',
hash: 'dc79c984a36b2f8a29007633bde4daf3',
id: '63-70',
locked: false,
lockedTo: null,
modifiedAt: 1714829527993,
oldStart: 63,
start: 63
}
};
export const file0 = {
binary: false,
conflicted: false,
hunks: [fileHunk],
id: "package.json",
id: 'package.json',
large: false,
modifiedAt: 1714829589111,
path: "package.json",
}
path: 'package.json'
};
export const virtualBranch = {
active: true,
@ -135,19 +135,20 @@ export const virtualBranch = {
commits: [],
conflicted: false,
files: [file0],
head: "90c225edcc74b31718a9cd8963c1bc89c17d8864",
id: "29cdc7a7-3462-4c14-a037-0a6cdad68da3",
name: "Virtual branch",
notes: "",
head: '90c225edcc74b31718a9cd8963c1bc89c17d8864',
id: '29cdc7a7-3462-4c14-a037-0a6cdad68da3',
name: 'Virtual branch',
notes: '',
order: 0,
ownership: "package.json:63-70-dc79c984a36b2f8a29007633bde4daf3-1714829528116,23-58-fbf18cec4afef8aafbbc2dddef3e3391-1714829528116,79-85-c4d0a57fca736c384cde2a68009ffcb3-1714829503193",
ownership:
'package.json:63-70-dc79c984a36b2f8a29007633bde4daf3-1714829528116,23-58-fbf18cec4afef8aafbbc2dddef3e3391-1714829528116,79-85-c4d0a57fca736c384cde2a68009ffcb3-1714829503193',
requiresForce: false,
updatedAt: 1714829503190,
upstream: null,
upstreamName: null,
}
upstreamName: null
};
export const virtualBranches = {
branches: [virtualBranch],
skippedFiles: []
}
};

View File

@ -1,59 +1,59 @@
import { baseBranch, project, remoteBranchData, user, virtualBranches } from "./fixtures"
import { mockIPC } from "@tauri-apps/api/mocks";
import { baseBranch, project, remoteBranchData, user, virtualBranches } from './fixtures';
import { mockIPC } from '@tauri-apps/api/mocks';
import { mockWindows } from '@tauri-apps/api/mocks';
export function mockTauri() {
mockWindows('main');
mockIPC((cmd, args) => {
console.log(`%c${cmd}`, 'background: #222; color: #4db2ad', args)
console.log(`%c${cmd}`, 'background: #222; color: #4db2ad', args);
// @ts-expect-error 'message' is dynamic
if (cmd === "tauri" && args.message?.cmd === "openDialog") {
return "/Users/user/project"
if (cmd === 'tauri' && args.message?.cmd === 'openDialog') {
return '/Users/user/project';
}
if (cmd === "list_projects") {
return [project]
if (cmd === 'list_projects') {
return [project];
}
if (cmd === "get_project" && args.id === "ac44a3bb-8bbb-4af9-b8c9-7950dd9ec295") {
return project
if (cmd === 'get_project' && args.id === 'ac44a3bb-8bbb-4af9-b8c9-7950dd9ec295') {
return project;
}
if (cmd === "git_head") {
return "refs/heads/gitbutler/integration"
if (cmd === 'git_head') {
return 'refs/heads/gitbutler/integration';
}
if (cmd === "menu_item_set_enabled") {
return null
if (cmd === 'menu_item_set_enabled') {
return null;
}
if (cmd === "fetch_from_target") {
return true
if (cmd === 'fetch_from_target') {
return true;
}
if (cmd === "get_base_branch_data") {
return baseBranch
if (cmd === 'get_base_branch_data') {
return baseBranch;
}
if (cmd === "list_virtual_branches") {
return virtualBranches
if (cmd === 'list_virtual_branches') {
return virtualBranches;
}
if (cmd === "list_remote_branches") {
return []
if (cmd === 'list_remote_branches') {
return [];
}
if (cmd === "get_remote_branch_data") {
return remoteBranchData
if (cmd === 'get_remote_branch_data') {
return remoteBranchData;
}
if (cmd === "get_remote_branchs") {
return ["refs/heads/abc123"]
if (cmd === 'get_remote_branchs') {
return ['refs/heads/abc123'];
}
if (cmd === "get_user") {
return user
if (cmd === 'get_user') {
return user;
}
});
}

View File

@ -1,6 +1,6 @@
import lscache from 'lscache';
import { BehaviorSubject, config } from 'rxjs';
import { env } from "$env/dynamic/public";
import { env } from '$env/dynamic/public';
import { AIService } from '$lib/ai/service';
import { initAnalyticsIfEnabled } from '$lib/analytics/analytics';
import { AuthService } from '$lib/backend/auth';
@ -26,7 +26,7 @@ export const csr = true;
export async function load() {
// Mock Tauri API during E2E tests
if (env.PUBLIC_TESTING) {
mockTauri()
mockTauri();
}
initAnalyticsIfEnabled();