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 = {
prepare
}

View file

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