-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v3' into fe-6228-schema-pull-api
- Loading branch information
Showing
3 changed files
with
51 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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("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; | ||
}); | ||
}); | ||
}); |