chore(cli): clean imports

This commit is contained in:
Ayo Ayco 2024-12-07 10:56:57 +01:00
parent 09cd38a481
commit 6c7877b049
2 changed files with 12 additions and 15 deletions

View file

@ -33,7 +33,6 @@ export default defineCommand({
}, },
}); });
export const exportedForTest = { export const exportedForTest = {
prepare prepare
} }

View file

@ -1,29 +1,27 @@
import { test } from "vitest"; import { test, expect, vi } from "vitest";
import { exportedForTest } from "../commands/prepare.mjs"; import { exportedForTest } from "../commands/prepare.mjs";
import { vi } from "vitest";
import consola from "consola"; import consola from "consola";
import { expect } from "vitest"; import { execSync } from "node:child_process";
import {execSync} from "node:child_process";
const testFn = exportedForTest.prepare; const testFn = exportedForTest.prepare;
test('start prepare script', () => { test("start prepare script", () => {
const spy = vi.spyOn(consola, 'start'); const spy = vi.spyOn(consola, "start");
testFn(); testFn();
expect(spy).toHaveBeenCalled() expect(spy).toHaveBeenCalled();
}) });
test('execute nitropack prepare', () => { test("execute nitropack prepare", () => {
const command = 'npx nitropack prepare'; const command = "npx nitropack prepare";
const param = {stdio: 'inherit'}; const param = { stdio: "inherit" };
vi.mock('node:child_process'); vi.mock("node:child_process");
testFn(); testFn();
expect(execSync).toHaveBeenCalled(); expect(execSync).toHaveBeenCalled();
}) });
/** /**
* TODO: * TODO: