diff --git a/src/commands/database/create.mjs b/src/commands/database/create.mjs index db1691d7..fe19d606 100644 --- a/src/commands/database/create.mjs +++ b/src/commands/database/create.mjs @@ -79,7 +79,7 @@ function buildCreateCommand(yargs) { description: "Name of the child database to create.", }, typechecked: { - type: "string", + type: "boolean", description: "Enable typechecking for the database. Defaults to the typechecking setting of the parent database.", }, diff --git a/test/database/create.mjs b/test/database/create.mjs index c997c57c..4033ddee 100644 --- a/test/database/create.mjs +++ b/test/database/create.mjs @@ -45,6 +45,29 @@ describe("database create", () => { }); }); + [ + { + flag: "--typechecked", + value: "imastring", + }, + { + flag: "--protected", + value: "imastring", + }, + ].forEach(({ flag, value }) => { + it(`handles invalid option types: ${flag} ${value}`, async () => { + try { + await run( + `database create --name 'testdb' --secret 'secret' ${flag} ${value}`, + container, + ); + } catch (e) {} + // Make sure we bail before calling fauna + expect(runQuery).to.not.have.been.called; + expect(logger.stderr).to.have.been.called; + }); + }); + [ { error: new ServiceError({