From 5de20d26326b429fa8d9f9437a2ba083a73f23f5 Mon Sep 17 00:00:00 2001 From: Enderson Maia Date: Tue, 15 Oct 2024 16:25:56 -0300 Subject: [PATCH] tests(cli): increasing unit test coverage --- apps/cli/test/config.test.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/apps/cli/test/config.test.ts b/apps/cli/test/config.test.ts index 7ddb0a79..1845308b 100644 --- a/apps/cli/test/config.test.ts +++ b/apps/cli/test/config.test.ts @@ -4,8 +4,10 @@ import { defaultMachineConfig, InvalidBooleanValueError, InvalidBuilderError, + InvalidBytesValueError, InvalidDriveFormatError, InvalidEmptyDriveFormatError, + InvalidNumberValueError, InvalidStringValueError, parse, RequiredFieldError, @@ -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] @@ -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]