-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test case for the ordering warning
- Loading branch information
1 parent
237785e
commit fb4b993
Showing
3 changed files
with
67 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ node_modules | |
.migrate | ||
*.db | ||
migrations/ | ||
test/fixtures/tmp |
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,57 @@ | ||
/* global describe, it, beforeEach */ | ||
const path = require('path') | ||
const assert = require('assert') | ||
const rimraf = require('rimraf') | ||
const mkdirp = require('mkdirp') | ||
const run = require('./util/run') | ||
|
||
// Paths | ||
const TMP_DIR = path.join(__dirname, 'fixtures', 'tmp') | ||
|
||
function reset () { | ||
rimraf.sync(TMP_DIR) | ||
mkdirp.sync(TMP_DIR) | ||
} | ||
|
||
describe('integration tests', function () { | ||
beforeEach(reset) | ||
|
||
it('should warn when the migrations are run out of order', function (done) { | ||
run.init(TMP_DIR, [], function (err, out, code) { | ||
assert(!err) | ||
assert.equal(code, 0) | ||
|
||
run.create(TMP_DIR, ['1-one', '-d', 'W'], function (err, out, code) { | ||
assert(!err) | ||
assert.equal(code, 0) | ||
|
||
run.create(TMP_DIR, ['3-three', '-d', 'W'], function (err, out, code) { | ||
assert(!err) | ||
assert.equal(code, 0) | ||
|
||
run.up(TMP_DIR, [], function (err, out, code) { | ||
assert(!err) | ||
assert.equal(code, 0) | ||
|
||
run.create(TMP_DIR, ['2-two', '-d', 'W'], function (err, out, code) { | ||
assert(!err) | ||
assert.equal(code, 0) | ||
|
||
run.up(TMP_DIR, [], function (err, out, code) { | ||
assert(!err) | ||
assert.equal(code, 0) | ||
|
||
// A warning should log, and the process not exit with 0 | ||
// because migration 2 should come before migration 3, | ||
// but migration 3 was already run from the previous | ||
// state | ||
assert(out.indexOf('warn') !== -1) | ||
done() | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) |
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