chore:: apply prettier formatting to entire codebase
This commit is contained in:
1 parent
695d787b01
commit
a343e0c1ae
43 files changed
+408
-485
No files matched your search
@@ -1,45 +1,45 @@
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
import {
|
||||
listAccountsData,
|
||||
addAccountSnapshot,
|
||||
switchAccount,
|
||||
deleteAccount,
|
||||
} from "../../ipc/account/handler";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
} from '../../ipc/account/handler';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
// Mock dependencies
|
||||
vi.mock("../../utils/paths", async () => {
|
||||
const path = await import("path");
|
||||
const agentDir = path.join(process.cwd(), "temp_test_agent");
|
||||
vi.mock('../../utils/paths', async () => {
|
||||
const path = await import('path');
|
||||
const agentDir = path.join(process.cwd(), 'temp_test_agent');
|
||||
return {
|
||||
getAgentDir: vi.fn(() => agentDir),
|
||||
getAccountsFilePath: vi.fn(() => path.join(agentDir, "accounts.json")),
|
||||
getBackupsDir: vi.fn(() => path.join(agentDir, "backups")),
|
||||
getAntigravityDbPath: vi.fn(() => path.join(agentDir, "state.vscdb")),
|
||||
getAntigravityExecutablePath: vi.fn(() => "mock_exec_path"),
|
||||
getAccountsFilePath: vi.fn(() => path.join(agentDir, 'accounts.json')),
|
||||
getBackupsDir: vi.fn(() => path.join(agentDir, 'backups')),
|
||||
getAntigravityDbPath: vi.fn(() => path.join(agentDir, 'state.vscdb')),
|
||||
getAntigravityExecutablePath: vi.fn(() => 'mock_exec_path'),
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock("../../ipc/database/handler", () => ({
|
||||
vi.mock('../../ipc/database/handler', () => ({
|
||||
getCurrentAccountInfo: vi.fn(() => ({
|
||||
email: "[email protected]",
|
||||
name: "Test User",
|
||||
email: '[email protected]',
|
||||
name: 'Test User',
|
||||
isAuthenticated: true,
|
||||
})),
|
||||
backupAccount: vi.fn((account) => ({ version: "1.0", account, data: {} })),
|
||||
backupAccount: vi.fn((account) => ({ version: '1.0', account, data: {} })),
|
||||
restoreAccount: vi.fn(),
|
||||
getDatabaseConnection: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("../../ipc/process/handler", () => ({
|
||||
vi.mock('../../ipc/process/handler', () => ({
|
||||
closeAntigravity: vi.fn(),
|
||||
startAntigravity: vi.fn(),
|
||||
isProcessRunning: vi.fn(() => Promise.resolve(false)),
|
||||
}));
|
||||
|
||||
describe("Account Handler", () => {
|
||||
const testAgentDir = path.join(process.cwd(), "temp_test_agent");
|
||||
describe('Account Handler', () => {
|
||||
const testAgentDir = path.join(process.cwd(), 'temp_test_agent');
|
||||
|
||||
beforeEach(() => {
|
||||
if (fs.existsSync(testAgentDir)) {
|
||||
@@ -54,22 +54,22 @@ describe("Account Handler", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("should add account snapshot", async () => {
|
||||
it('should add account snapshot', async () => {
|
||||
const account = await addAccountSnapshot();
|
||||
expect(account.email).toBe("[email protected]");
|
||||
expect(account.email).toBe('[email protected]');
|
||||
|
||||
const accounts = await listAccountsData();
|
||||
expect(accounts).toHaveLength(1);
|
||||
expect(accounts[0].email).toBe("[email protected]");
|
||||
expect(accounts[0].email).toBe('[email protected]');
|
||||
});
|
||||
|
||||
it("should switch account", async () => {
|
||||
it('should switch account', async () => {
|
||||
const account = await addAccountSnapshot();
|
||||
await switchAccount(account.id);
|
||||
// Mocks should be called, verified by implementation logic not throwing
|
||||
});
|
||||
|
||||
it("should delete account", async () => {
|
||||
it('should delete account', async () => {
|
||||
const account = await addAccountSnapshot();
|
||||
await deleteAccount(account.id);
|
||||
|
||||
|
||||
Reference in new issue
Block a user