Skip to content

Commit

Permalink
tests(cli): increasing unit test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
endersonmaia authored and tuler committed Oct 17, 2024
1 parent bf82605 commit 78de956
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions apps/cli/test/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import {
defaultMachineConfig,
InvalidBooleanValueError,
InvalidBuilderError,
InvalidBytesValueError,
InvalidDriveFormatError,
InvalidEmptyDriveFormatError,
InvalidNumberValueError,
InvalidStringValueError,
parse,
RequiredFieldError,
Expand Down Expand Up @@ -109,6 +111,12 @@ shared = true`);
);
});

it("invalid number value", () => {
expect(() => parse("[machine]\nmax-mcycle = 'abc'")).toThrowError(
new InvalidNumberValueError("abc"),
);
});

it("invalid string value", () => {
const invalidTarDrive = `
[drives.data]
Expand All @@ -121,6 +129,18 @@ shared = true`);
);
});

it("invalid bytes value", () => {
expect(() => parse("[machine]\nram-length = 'abc'")).toThrowError(
new InvalidBytesValueError("abc"),
);
});

it("invalid boolean", () => {
expect(() =>
parse("[machine]\nassert_rolling_update = 42"),
).toThrowError(new InvalidBooleanValueError(42));
});

it("required field", () => {
const invalidDirectoryDrive = `
[drives.data]
Expand Down

0 comments on commit 78de956

Please sign in to comment.