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 34099288
authored
Nov 06, 2014
by
Seth Samuel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Promisify tests
1 parent
4297b31b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
44 deletions
test/dao-factory.test.js
test/dao.test.js
test/dao-factory.test.js
View file @
3409928
...
@@ -1305,25 +1305,21 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1305,25 +1305,21 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
describe
(
"undestroy"
,
function
(){
describe
(
"undestroy"
,
function
(){
it
(
"returns an error if the model is not paranoid"
,
function
(
done
){
it
(
"returns an error if the model is not paranoid"
,
function
(){
var
self
=
this
;
var
self
=
this
;
this
.
User
.
create
({
username
:
"Peter"
,
secretValue
:
"42"
})
return
this
.
User
.
create
({
username
:
"Peter"
,
secretValue
:
"42"
}).
then
(
function
(
user
){
.
success
(
function
(
user
){
return
user
.
destroy
().
then
(
function
(){
user
.
destroy
()
return
self
.
User
.
undestroy
({
where
:
{
username
:
"Peter"
}}).
then
(
function
(){
.
success
(
function
(){
expect
(
false
).
to
.
be
.
ok
self
.
User
.
undestroy
({
where
:
{
username
:
"Peter"
}})
},
function
(
err
){
.
success
(
function
(){
expect
(
err
).
to
.
exist
done
(
"Should not return success for unparanoid model"
);
})
.
error
(
function
(
err
){
done
()
})
})
})
})
})
})
})
})
it
(
"restores a previously deleted model"
,
function
(
done
){
it
(
"restores a previously deleted model"
,
function
(){
var
self
=
this
var
self
=
this
,
ParanoidUser
=
self
.
sequelize
.
define
(
'ParanoidUser'
,
{
,
ParanoidUser
=
self
.
sequelize
.
define
(
'ParanoidUser'
,
{
username
:
Sequelize
.
STRING
,
username
:
Sequelize
.
STRING
,
...
@@ -1337,17 +1333,13 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1337,17 +1333,13 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
{
username
:
'Paul'
,
secretValue
:
'43'
},
{
username
:
'Paul'
,
secretValue
:
'43'
},
{
username
:
'Bob'
,
secretValue
:
'44'
}]
{
username
:
'Bob'
,
secretValue
:
'44'
}]
ParanoidUser
.
sync
({
force
:
true
}).
success
(
function
()
{
return
ParanoidUser
.
sync
({
force
:
true
}).
then
(
function
()
{
ParanoidUser
.
bulkCreate
(
data
).
success
(
function
()
{
return
ParanoidUser
.
bulkCreate
(
data
).
then
(
function
()
{
ParanoidUser
.
destroy
({
where
:
{
secretValue
:
'42'
}})
return
ParanoidUser
.
destroy
({
where
:
{
secretValue
:
'42'
}}).
then
(
function
()
{
.
success
(
function
()
{
return
ParanoidUser
.
undestroy
({
where
:
{
secretValue
:
'42'
}}).
then
(
function
()
{
ParanoidUser
.
undestroy
({
where
:
{
secretValue
:
'42'
}})
return
ParanoidUser
.
find
({
where
:
{
secretValue
:
"42"
}}).
then
(
function
(
user
){
.
success
(
function
()
{
ParanoidUser
.
find
({
where
:
{
secretValue
:
"42"
}})
.
success
(
function
(
user
){
expect
(
user
).
to
.
be
.
ok
expect
(
user
).
to
.
be
.
ok
expect
(
user
.
username
).
to
.
equal
(
"Peter"
)
expect
(
user
.
username
).
to
.
equal
(
"Peter"
)
done
()
})
})
})
})
})
})
...
...
test/dao.test.js
View file @
3409928
...
@@ -1799,25 +1799,21 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
...
@@ -1799,25 +1799,21 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
})
})
describe
(
"undestroy"
,
function
(){
describe
(
"undestroy"
,
function
(){
it
(
"returns an error if the model is not paranoid"
,
function
(
done
){
it
(
"returns an error if the model is not paranoid"
,
function
(){
var
self
=
this
;
var
self
=
this
;
this
.
User
.
create
({
username
:
"Peter"
,
secretValue
:
"42"
})
return
this
.
User
.
create
({
username
:
"Peter"
,
secretValue
:
"42"
}).
then
(
function
(
user
){
.
success
(
function
(
user
){
return
user
.
destroy
().
then
(
function
(){
user
.
destroy
()
return
user
.
undestroy
().
then
(
function
(){
.
success
(
function
(){
expect
(
false
).
to
.
be
.
ok
user
.
undestroy
()
},
function
(
err
){
.
success
(
function
(){
expect
(
err
).
to
.
exist
done
(
"Should not return success for unparanoid model"
);
})
.
error
(
function
(
err
){
done
()
})
})
})
})
})
})
})
})
it
(
"restores a previously deleted model"
,
function
(
done
){
it
(
"restores a previously deleted model"
,
function
(){
var
self
=
this
var
self
=
this
,
ParanoidUser
=
self
.
sequelize
.
define
(
'ParanoidUser'
,
{
,
ParanoidUser
=
self
.
sequelize
.
define
(
'ParanoidUser'
,
{
username
:
DataTypes
.
STRING
,
username
:
DataTypes
.
STRING
,
...
@@ -1831,19 +1827,14 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
...
@@ -1831,19 +1827,14 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
{
username
:
'Paul'
,
secretValue
:
'43'
},
{
username
:
'Paul'
,
secretValue
:
'43'
},
{
username
:
'Bob'
,
secretValue
:
'44'
}]
{
username
:
'Bob'
,
secretValue
:
'44'
}]
ParanoidUser
.
sync
({
force
:
true
}).
success
(
function
()
{
return
ParanoidUser
.
sync
({
force
:
true
}).
then
(
function
()
{
ParanoidUser
.
bulkCreate
(
data
).
success
(
function
()
{
return
ParanoidUser
.
bulkCreate
(
data
).
then
(
function
()
{
ParanoidUser
.
find
({
where
:
{
secretValue
:
"42"
}})
return
ParanoidUser
.
find
({
where
:
{
secretValue
:
"42"
}}).
then
(
function
(
user
){
.
success
(
function
(
user
){
return
user
.
destroy
().
then
(
function
()
{
user
.
destroy
()
return
user
.
undestroy
().
then
(
function
()
{
.
success
(
function
()
{
return
ParanoidUser
.
find
({
where
:
{
secretValue
:
"42"
}}).
then
(
function
(
user
){
user
.
undestroy
()
.
success
(
function
()
{
ParanoidUser
.
find
({
where
:
{
secretValue
:
"42"
}})
.
success
(
function
(
user
){
expect
(
user
).
to
.
be
.
ok
expect
(
user
).
to
.
be
.
ok
expect
(
user
.
username
).
to
.
equal
(
"Peter"
)
expect
(
user
.
username
).
to
.
equal
(
"Peter"
)
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