-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests for list with valid and unrecognized status
- Loading branch information
Showing
4 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
tap-snapshots/test-02-snapshot-bin-east-commands-list-withStatus.js-TAP.test.js
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,13 @@ | ||
/* IMPORTANT | ||
* This snapshot file is auto-generated, but designed for humans. | ||
* It should be checked into source control and tracked carefully. | ||
* Re-generate by setting TAP_SNAPSHOT=1 and running tests. | ||
* Make sure to inspect the output below. Do not ignore changes! | ||
*/ | ||
'use strict' | ||
exports[`test/02-snapshot/bin/east/commands/list/withStatus.js TAP > output 1`] = ` | ||
new migrations: | ||
1_someMigrationName | ||
2_anotherMigrationName | ||
` |
11 changes: 11 additions & 0 deletions
11
tap-snapshots/test-02-snapshot-bin-east-commands-list-withUnrecognizedStatus.js-TAP.test.js
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,11 @@ | ||
/* IMPORTANT | ||
* This snapshot file is auto-generated, but designed for humans. | ||
* It should be checked into source control and tracked carefully. | ||
* Re-generate by setting TAP_SNAPSHOT=1 and running tests. | ||
* Make sure to inspect the output below. Do not ignore changes! | ||
*/ | ||
'use strict' | ||
exports[`test/02-snapshot/bin/east/commands/list/withUnrecognizedStatus.js TAP > output 1`] = ` | ||
Unrecognized status "unrecognizedStatus" | ||
` |
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,54 @@ | ||
'use strict'; | ||
|
||
const tap = require('tap'); | ||
const expect = require('expect.js'); | ||
const testUtils = require('../../../../../../testUtils'); | ||
|
||
tap.mochaGlobals(); | ||
|
||
const binPath = testUtils.getBinPath('east'); | ||
const describeTitle = 'bin/east list with status'; | ||
|
||
describe(describeTitle, () => { | ||
let commandResult; | ||
let migrator; | ||
|
||
before(() => { | ||
return Promise.resolve() | ||
.then(() => testUtils.createMigrator({init: true})) | ||
.then((createdMigrator) => { | ||
migrator = createdMigrator; | ||
|
||
return testUtils.createMigrations({ | ||
migrator, | ||
baseNames: ['someMigrationName', 'anotherMigrationName'] | ||
}); | ||
}); | ||
}); | ||
|
||
after(() => testUtils.destroyMigrator({migrator})); | ||
|
||
it('should be done without error', () => { | ||
const cwd = testUtils.getTestDirPath(); | ||
|
||
return Promise.resolve() | ||
.then(() => { | ||
return testUtils.execAsync( | ||
`"${binPath}" list new`, | ||
{cwd} | ||
); | ||
}) | ||
.then((result) => { | ||
expect(result.stderr).not.ok(); | ||
|
||
commandResult = result; | ||
}); | ||
}); | ||
|
||
it('stdout should match expected snapshot', () => { | ||
tap.matchSnapshot( | ||
testUtils.cleanSnapshotData(commandResult.stdout), | ||
'output' | ||
); | ||
}); | ||
}); |
61 changes: 61 additions & 0 deletions
61
test/02-snapshot/bin/east/commands/list/withUnrecognizedStatus.js
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,61 @@ | ||
'use strict'; | ||
|
||
const tap = require('tap'); | ||
const expect = require('expect.js'); | ||
const testUtils = require('../../../../../../testUtils'); | ||
|
||
tap.mochaGlobals(); | ||
|
||
const binPath = testUtils.getBinPath('east'); | ||
const describeTitle = 'bin/east list with unrecognized status'; | ||
|
||
describe(describeTitle, () => { | ||
let commandErr; | ||
let migrator; | ||
|
||
before(() => { | ||
return Promise.resolve() | ||
.then(() => testUtils.createMigrator({init: true})) | ||
.then((createdMigrator) => { | ||
migrator = createdMigrator; | ||
|
||
return testUtils.createMigrations({ | ||
migrator, | ||
baseNames: ['someMigrationName', 'anotherMigrationName'] | ||
}); | ||
}); | ||
}); | ||
|
||
after(() => testUtils.destroyMigrator({migrator})); | ||
|
||
it('should be done without error', () => { | ||
const cwd = testUtils.getTestDirPath(); | ||
|
||
return Promise.resolve() | ||
.then(() => { | ||
return testUtils.execAsync( | ||
`"${binPath}" list unrecognizedStatus`, | ||
{cwd} | ||
); | ||
}) | ||
.then((commandResult) => { | ||
throw new Error( | ||
`Error expexted but result returned: ${commandResult.stdout}` | ||
); | ||
}) | ||
.catch((err) => { | ||
expect(err).ok(); | ||
expect(err.code).equal(1); | ||
expect(err.stdout).not.ok(); | ||
|
||
commandErr = err; | ||
}); | ||
}); | ||
|
||
it('stderr should match expected snapshot', () => { | ||
tap.matchSnapshot( | ||
testUtils.cleanSnapshotData(commandErr.stderr), | ||
'output' | ||
); | ||
}); | ||
}); |