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 693b0a37
authored
Aug 18, 2013
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
transform bats tests into mocha tests
1 parent
b8b7ef2f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
0 deletions
.gitignore
test/sequelize.executable.test.js
.gitignore
View file @
693b0a3
...
@@ -6,3 +6,4 @@ node_modules
...
@@ -6,3 +6,4 @@ node_modules
npm-debug.log
npm-debug.log
*~
*~
test/binary/tmp/*
test/binary/tmp/*
test/tmp/*
test/sequelize.executable.test.js
0 → 100644
View file @
693b0a3
var
chai
=
require
(
'chai'
)
,
expect
=
chai
.
expect
,
Support
=
require
(
__dirname
+
'/support'
)
,
DataTypes
=
require
(
__dirname
+
"/../lib/data-types"
)
,
dialect
=
Support
.
getTestDialect
()
,
_
=
require
(
'lodash'
)
,
exec
=
require
(
'child_process'
).
exec
,
version
=
(
require
(
__dirname
+
'/../package.json'
)).
version
chai
.
Assertion
.
includeStack
=
true
describe
(
Support
.
getTestDialectTeaser
(
"Executable"
),
function
()
{
describe
(
'call without arguments'
,
function
()
{
it
(
"prints usage instructions"
,
function
(
done
)
{
exec
(
'bin/sequelize'
,
function
(
err
,
stdout
,
stderr
)
{
expect
(
stdout
).
to
.
include
(
"No action specified. Try \"sequelize --help\" for usage information."
)
done
()
})
})
})
;(
function
(
flags
)
{
flags
.
forEach
(
function
(
flag
)
{
describe
(
flag
,
function
()
{
it
(
"prints the help"
,
function
(
done
)
{
exec
(
"bin/sequelize "
+
flag
,
function
(
err
,
stdout
,
stderr
)
{
expect
(
stdout
).
to
.
include
(
"Usage: sequelize [options]"
)
done
()
})
})
})
})
})([
"--help"
,
"-h"
])
;(
function
(
flags
)
{
flags
.
forEach
(
function
(
flag
)
{
describe
(
flag
,
function
()
{
it
(
"prints the help"
,
function
(
done
)
{
exec
(
"bin/sequelize "
+
flag
,
function
(
err
,
stdout
,
stderr
)
{
expect
(
version
).
to
.
not
.
be
.
empty
expect
(
stdout
).
to
.
include
(
version
)
done
()
})
})
})
})
})([
'--version'
,
'-V'
])
;(
function
(
flags
)
{
flags
.
forEach
(
function
(
flag
)
{
describe
(
flag
,
function
()
{
;(
function
(
folders
)
{
folders
.
forEach
(
function
(
folder
)
{
it
(
"creates a '"
+
folder
+
"' folder"
,
function
(
done
)
{
exec
(
"rm -rf ./*"
,
{
cwd
:
__dirname
+
'/tmp'
},
function
()
{
exec
(
"../../bin/sequelize --init"
,
{
cwd
:
__dirname
+
'/tmp'
},
function
()
{
exec
(
"ls -ila"
,
{
cwd
:
__dirname
+
'/tmp'
},
function
(
err
,
stdout
)
{
expect
(
stdout
).
to
.
include
(
folder
)
done
()
})
})
})
})
})
})([
'config'
,
'migrations'
])
it
(
"creates a config.json file"
,
function
(
done
)
{
exec
(
"rm -rf ./*"
,
{
cwd
:
__dirname
+
'/tmp'
},
function
()
{
exec
(
"../../bin/sequelize --init"
,
{
cwd
:
__dirname
+
'/tmp'
},
function
()
{
exec
(
"ls -ila config"
,
{
cwd
:
__dirname
+
'/tmp'
},
function
(
err
,
stdout
)
{
expect
(
stdout
).
to
.
include
(
'config.json'
)
done
()
})
})
})
})
it
(
"does not overwrite an existing config.json file"
,
function
(
done
)
{
exec
(
"rm -rf ./*"
,
{
cwd
:
__dirname
+
'/tmp'
},
function
()
{
exec
(
"../../bin/sequelize --init"
,
{
cwd
:
__dirname
+
'/tmp'
},
function
()
{
exec
(
"echo 'foo' > config/config.json"
,
{
cwd
:
__dirname
+
'/tmp'
},
function
()
{
exec
(
"../../bin/sequelize --init"
,
{
cwd
:
__dirname
+
'/tmp'
},
function
(
err
)
{
expect
(
err
.
code
).
to
.
equal
(
1
)
exec
(
"cat config/config.json"
,
{
cwd
:
__dirname
+
'/tmp'
},
function
(
err
,
stdout
)
{
expect
(
stdout
).
to
.
equal
(
"foo\n"
)
done
()
})
})
})
})
})
})
})
})
})([
'--init'
,
'-i'
])
})
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