Skip to content

Commit

Permalink
add a test for real
Browse files Browse the repository at this point in the history
  • Loading branch information
henryfauna committed Dec 10, 2024
1 parent 26eb68f commit d1de3f5
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/schema/schema.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//@ts-check

import { expect } from "chai";
import chalk from "chalk";

import { builtYargs, run } from "../../src/cli.mjs";
import { setupTestContainer as setupContainer } from "../../src/config/setup-test-container.mjs";

describe.only("schema", function () {
let container, logger;
beforeEach(() => {
container = setupContainer();
logger = container.resolve("logger");
});

[
{ command: "schema status" },
{ command: "schema push" },
{ command: "schema abandon" },
{ command: "schema diff" },
{ command: "schema pull" },
{ command: "schema commit" },
].forEach(({ command }) => {
it(`requires a database or secret to call: ${command}`, async function () {
try {
await run(command, container);
} catch (e) {}

expect(logger.stderr).to.have.been.calledWith(
`${chalk.reset(await builtYargs.getHelp())}\n\n${chalk.red("No database or secret specified. Please use either --database, --secret, or --local to connect to your desired Fauna database.")}`,
);
expect(container.resolve("parseYargs")).to.have.been.calledOnce;
});
});
});

0 comments on commit d1de3f5

Please sign in to comment.