Skip to content

Commit

Permalink
🧠 redesign Prepare for TestService rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
Lord-Valen committed Jan 23, 2023
1 parent b9299da commit 355a96d
Show file tree
Hide file tree
Showing 14 changed files with 310 additions and 422 deletions.
5 changes: 1 addition & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ end_of_line=lf
indent_size=2
indent_style=space
insert_final_newline=true
max_line_length=120
trim_trailing_whitespace=true

[*.md]
Expand All @@ -18,10 +19,6 @@ indent_size=unset
insert_final_newline=unset
trim_trailing_whitespace=unset

[*.{tsx?,jsx?,json}]
indent_size=4
max_line_length=120

[{LICENSES/**,LICENSE,*.lock,package-lock.json}]
charset=unset
end_of_line=unset
Expand Down
20 changes: 8 additions & 12 deletions nix/_automation/configs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,13 @@ in {
root = true;

"*" = {
end_of_line = "lf";
insert_final_newline = true;
trim_trailing_whitespace = true;
charset = "utf-8";
indent_style = "space";
end_of_line = "lf";
indent_size = 2;
};

"*.{tsx?,jsx?,json}" = {
indent_style = "space";
insert_final_newline = true;
max_line_length = 120;
indent_size = 4;
trim_trailing_whitespace = true;
};

"*.md" = {
Expand All @@ -31,17 +27,17 @@ in {
"*.{diff,patch}" = {
end_of_line = "unset";
insert_final_newline = "unset";
trim_trailing_whitespace = "unset";
indent_size = "unset";
trim_trailing_whitespace = "unset";
};

"{LICENSES/**,LICENSE,*.lock,package-lock.json}" = {
charset = "unset";
end_of_line = "unset";
indent_size = "unset";
indent_style = "unset";
insert_final_newline = "unset";
trim_trailing_whitespace = "unset";
charset = "unset";
indent_style = "unset";
indent_size = "unset";
};
};
hook.mode = "copy";
Expand Down
102 changes: 58 additions & 44 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions src/App.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import "reflect-metadata";

import { Container } from "inversify";
import { bindings } from "./bindings.js";
import { IApp, INixService, IRenderService, ITestFinder } from "./interfaces.js";
import { IApp, INixService, IRenderService, TestService } from "./interfaces.js";
import { CliArgs, Schema, schemaVer, TestFile } from "./types.js";

const nixService = {
Expand All @@ -13,7 +13,7 @@ const renderService = {
run: vi.fn()
}

const testFinder = {
const testService = {
run: vi.fn(async (): Promise<TestFile[]> => { return [] })
}

Expand All @@ -29,7 +29,7 @@ describe("App", () => {
container.load(bindings);
container.rebind(INixService).toConstantValue(nixService);
container.rebind(IRenderService).toConstantValue(renderService);
container.rebind(ITestFinder).toConstantValue(testFinder);
container.rebind(TestService).toConstantValue(testService);

sut = container.get(IApp);
});
Expand Down Expand Up @@ -82,15 +82,15 @@ describe("App", () => {

await sut.run(args);

expect(testFinder.run).toHaveBeenCalledOnce();
expect(testService.run).toHaveBeenCalledOnce();
});

it("runs in flake mode when no path is given", async () => {
nixService.run.mockReturnValueOnce(registry);

await sut.run(args);

expect(testFinder.run).toHaveBeenCalledTimes(0);
expect(testService.run).toHaveBeenCalledTimes(0);
expect(renderService.run).toHaveBeenCalledWith(args, registry.testSpec);
});

Expand All @@ -101,7 +101,7 @@ describe("App", () => {

await sut.run(args);

expect(testFinder.run).toHaveBeenCalledOnce();
expect(testService.run).toHaveBeenCalledOnce();
expect(renderService.run).toHaveBeenCalledWith(args, []);
});

Expand All @@ -110,7 +110,7 @@ describe("App", () => {

await sut.run(args);

expect(testFinder.run).toHaveBeenCalledOnce();
expect(testService.run).toHaveBeenCalledOnce();
expect(renderService.run).toHaveBeenCalledWith(args, []);
});

Expand All @@ -120,7 +120,7 @@ describe("App", () => {

await sut.run(args);

expect(testFinder.run).toHaveBeenCalledOnce();
expect(testService.run).toHaveBeenCalledOnce();
expect(renderService.run).toHaveBeenCalledWith(args, []);
});

Expand Down
Loading

0 comments on commit 355a96d

Please sign in to comment.