Skip to content

Commit

Permalink
Fix lint issues and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vikingair committed Jan 13, 2024
1 parent 83c2729 commit 9e47ea7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
4 changes: 2 additions & 2 deletions brocolito/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export type SnakeToCamelCase<S extends string> =
export type OptionToName<S extends string> = S extends `--${infer T} ${string}`
? SnakeToCamelCase<T>
: S extends `--${infer T}`
? SnakeToCamelCase<T>
: never;
? SnakeToCamelCase<T>
: never;

type RemoveArgumentBrackets<S extends string> = S extends `<${infer T}>`
? T
Expand Down
23 changes: 20 additions & 3 deletions create-brocolito-cli/tests/templates.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,26 @@ import { describe, it, expect } from "vitest";
import { Templates } from "../src/templates";

describe("templates", () => {
it("replaces the properties of the current package.json", () => {
expect(JSON.parse(Templates.packageJson("foo"))).toEqual(
expect.objectContaining({ name: "foo", bin: { foo: "./build/cli.cjs" } }),
it("replaces the properties of the current package.json (runtime: node)", () => {
expect(JSON.parse(Templates.packageJson("foo", "node"))).toEqual(
expect.objectContaining({
name: "foo",
bin: { foo: "./build/cli.cjs" },
scripts: expect.objectContaining({ build: "brocolito" }),
}),
);
});

it("replaces the properties of the current package.json (runtime: bun)", () => {
expect(JSON.parse(Templates.packageJson("foo", "bun"))).toEqual(
expect.objectContaining({
name: "foo",
bin: { foo: "./build/cli.cjs" },
scripts: expect.objectContaining({
build: "brocolito-bun",
test: "bun test",
}),
}),
);
});
});

0 comments on commit 9e47ea7

Please # to comment.