Skip to content

Commit

Permalink
Update vitest (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroki0525 authored Jan 11, 2024
1 parent 8446b6e commit 16a4192
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 109 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"tsx": "^4.7.0",
"turbo": "^1.11.3",
"typescript": "5.3.3",
"vitest": "^0.34.6"
"vitest": "^1.1.3"
},
"packageManager": "pnpm@8.14.0",
"engines": {
Expand Down
12 changes: 3 additions & 9 deletions packages/cli/src/core/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ import generateDandoriTasks, {
OptionalTaskPropsOption,
} from "@dandori/core";

const { actualLoadFile } = await vi.hoisted(async () => {
const actualModule = await import("@dandori/libs");
return {
actualLoadFile: actualModule.loadFile,
};
});

const tasks: DandoriTask[] = [
{
id: "1",
Expand All @@ -39,13 +32,14 @@ vi.mock("@dandori/core", () => ({

const mockLogError = vi.fn();

vi.mock("@dandori/libs", () => {
vi.mock("@dandori/libs", async (importOriginal) => {
const actualModule = await importOriginal<typeof import("@dandori/libs")>();
return {
...actualModule,
getLogLevel: () => "info",
getLogger: vi.fn(() => ({
error: mockLogError,
})),
loadFile: actualLoadFile,
};
});

Expand Down
14 changes: 7 additions & 7 deletions packages/cli/src/notion/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe("DandoriNotionCli", () => {
});

it("call generateDandoriNotionPages with database id", () => {
expect(mockGenerateDandoriNotionPages.mock.lastCall[1]).toContain({
expect(mockGenerateDandoriNotionPages.mock.lastCall[1]).toMatchObject({
databaseId,
});
});
Expand All @@ -81,7 +81,7 @@ describe("DandoriNotionCli", () => {
it("call generateDandoriNotionPages with databasePropertiesMap.name", () => {
expect(
mockGenerateDandoriNotionPages.mock.lastCall[1].databasePropertiesMap,
).toContain({
).toMatchObject({
name,
});
});
Expand All @@ -98,7 +98,7 @@ describe("DandoriNotionCli", () => {
it("call generateDandoriNotionPages with databasePropertiesMap.deadline", () => {
expect(
mockGenerateDandoriNotionPages.mock.lastCall[1].databasePropertiesMap,
).toContain({
).toMatchObject({
deadline,
});
});
Expand All @@ -115,7 +115,7 @@ describe("DandoriNotionCli", () => {
it("call generateDandoriNotionPages with databasePropertiesMap.status", () => {
expect(
mockGenerateDandoriNotionPages.mock.lastCall[1].databasePropertiesMap,
).toContain({
).toMatchObject({
status,
});
});
Expand All @@ -132,7 +132,7 @@ describe("DandoriNotionCli", () => {
it("call generateDandoriNotionPages with databasePropertiesMap.status.todo", () => {
expect(
mockGenerateDandoriNotionPages.mock.lastCall[1].databasePropertiesMap,
).toContain({
).toMatchObject({
"status.todo": statusTodo,
});
});
Expand All @@ -149,7 +149,7 @@ describe("DandoriNotionCli", () => {
it("call generateDandoriNotionPages with databasePropertiesMap.status.doing", () => {
expect(
mockGenerateDandoriNotionPages.mock.lastCall[1].databasePropertiesMap,
).toContain({
).toMatchObject({
"status.doing": statusDoing,
});
});
Expand All @@ -166,7 +166,7 @@ describe("DandoriNotionCli", () => {
it("call generateDandoriNotionPages with databasePropertiesMap.status.done", () => {
expect(
mockGenerateDandoriNotionPages.mock.lastCall[1].databasePropertiesMap,
).toContain({
).toMatchObject({
"status.done": statusDone,
});
});
Expand Down
Loading

0 comments on commit 16a4192

Please sign in to comment.