Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 45a70ac0
authored
Nov 23, 2011
by
sdepold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getUndoneMigrations specs
1 parent
3f6d2cf8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
2 deletions
spec/migrator.spec.js
spec/migrator.spec.js
View file @
45a70ac
...
@@ -5,17 +5,73 @@ var config = require("./config/config")
...
@@ -5,17 +5,73 @@ var config = require("./config/config")
,
Migrator
=
require
(
"../lib/migrator"
)
,
Migrator
=
require
(
"../lib/migrator"
)
describe
(
'Migrator'
,
function
()
{
describe
(
'Migrator'
,
function
()
{
describe
(
'getUndoneMigrations'
,
function
()
{
var
migrator
=
null
var
setup
=
function
(
_options
)
{
var
options
=
Sequelize
.
Utils
.
_
.
extend
({
path
:
__dirname
+
'/assets/migrations'
},
_options
||
{})
migrator
=
new
Migrator
(
sequelize
,
options
)
}
beforeEach
(
function
()
{
migrator
=
null
})
// specs
it
(
"returns no files if timestamps are after the files timestamp"
,
function
()
{
setup
({
from
:
20120101010101
})
Helpers
.
async
(
function
(
done
)
{
migrator
.
getUndoneMigrations
(
function
(
files
)
{
expect
(
files
.
length
).
toEqual
(
0
)
done
()
})
})
})
it
(
"returns only files between from and to"
,
function
()
{
setup
({
from
:
19700101000000
,
to
:
20111117063700
})
Helpers
.
async
(
function
(
done
)
{
migrator
.
getUndoneMigrations
(
function
(
files
)
{
expect
(
files
.
length
).
toEqual
(
1
)
expect
(
files
[
0
]).
toEqual
(
'20111117063700-createPerson.js'
)
done
()
})
})
})
it
(
"returns also the file which is exactly options.from or options.to"
,
function
()
{
setup
({
from
:
20111117063700
,
to
:
20111123060700
})
Helpers
.
async
(
function
(
done
)
{
migrator
.
getUndoneMigrations
(
function
(
files
)
{
expect
(
files
.
length
).
toEqual
(
2
)
expect
(
files
[
0
]).
toEqual
(
'20111117063700-createPerson.js'
)
expect
(
files
[
1
]).
toEqual
(
'20111123060700-addBirthdateToPerson.js'
)
done
()
})
})
})
//it("returns")
})
/*
describe('getLastMigrationId', function() {
describe('getLastMigrationId', function() {
it("should correctly transform array into IN", function() {
it("should correctly transform array into IN", function() {
Helpers.async(function(done) {
Helpers.async(function(done) {
new Migrator(sequelize, {
new Migrator(sequelize, {
path: __dirname + '/assets/migrations',
path: __dirname + '/assets/migrations',
from
:
20111117063700
,
from: 20111117063700
20111117063700
,
to: 20111117063700
to: 20111117063700
}).migrate().success(function() {
}).migrate().success(function() {
done()
done()
})
})
})
})
})
})
})
})
*/
})
})
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment