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 0d7bab62
authored
Nov 29, 2013
by
Andreas Lubbe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added tests for not equal null logic
1 parent
b7e07a59
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
6 deletions
test/dao-factory.test.js
test/dao-factory.test.js
View file @
0d7bab6
...
@@ -1454,8 +1454,9 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1454,8 +1454,9 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
var
self
=
this
var
self
=
this
this
.
User
.
bulkCreate
([
this
.
User
.
bulkCreate
([
{
username
:
'boo'
,
intVal
:
5
,
theDate
:
'2013-01-01 12:00'
},
{
username
:
'boo'
,
intVal
:
5
,
theDate
:
'2013-01-01 12:00'
},
{
username
:
'boo2'
,
intVal
:
10
,
theDate
:
'2013-01-10 12:00'
}
{
username
:
'boo2'
,
intVal
:
10
,
theDate
:
'2013-01-10 12:00'
},
{
username
:
'boo3'
,
intVal
:
null
,
theDate
:
null
}
]).
success
(
function
(
user2
)
{
]).
success
(
function
(
user2
)
{
done
()
done
()
})
})
...
@@ -1464,10 +1465,10 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1464,10 +1465,10 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it
(
'should be able to find rows where attribute is in a list of values'
,
function
(
done
)
{
it
(
'should be able to find rows where attribute is in a list of values'
,
function
(
done
)
{
this
.
User
.
findAll
({
this
.
User
.
findAll
({
where
:
{
where
:
{
username
:
[
'boo'
,
'boo2'
]
username
:
[
'boo'
,
'boo2'
,
'boo3'
]
}
}
}).
success
(
function
(
users
){
}).
success
(
function
(
users
){
expect
(
users
).
to
.
have
.
length
(
2
);
expect
(
users
).
to
.
have
.
length
(
3
);
done
()
done
()
});
});
})
})
...
@@ -1475,9 +1476,10 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1475,9 +1476,10 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it
(
'should not break when trying to find rows using an array of primary keys'
,
function
(
done
)
{
it
(
'should not break when trying to find rows using an array of primary keys'
,
function
(
done
)
{
this
.
User
.
findAll
({
this
.
User
.
findAll
({
where
:
{
where
:
{
id
:
[
1
,
2
,
3
]
id
:
[
1
,
2
,
3
,
4
]
}
}
}).
success
(
function
(
users
){
}).
success
(
function
(
users
){
expect
(
users
).
to
.
have
.
length
(
3
)
done
();
done
();
});
});
})
})
...
@@ -1507,9 +1509,11 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1507,9 +1509,11 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
}
}
}).
success
(
function
(
users
)
{
}).
success
(
function
(
users
)
{
expect
(
users
).
to
.
be
.
an
.
instanceof
(
Array
)
expect
(
users
).
to
.
be
.
an
.
instanceof
(
Array
)
expect
(
users
).
to
.
have
.
length
(
1
)
expect
(
users
).
to
.
have
.
length
(
2
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo'
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo'
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
5
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
5
)
expect
(
users
[
1
].
username
).
to
.
equal
(
'boo3'
)
expect
(
users
[
1
].
intVal
).
to
.
equal
(
null
)
done
()
done
()
})
})
})
})
...
@@ -1522,6 +1526,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1522,6 +1526,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
}
}
}
}
}).
success
(
function
(
users
)
{
}).
success
(
function
(
users
)
{
expect
(
users
).
to
.
have
.
length
(
1
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo2'
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo2'
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
10
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
10
)
done
()
done
()
...
@@ -1536,6 +1541,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1536,6 +1541,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
}
}
}
}
}).
success
(
function
(
users
)
{
}).
success
(
function
(
users
)
{
expect
(
users
).
to
.
have
.
length
(
1
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo'
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo'
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
5
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
5
)
done
()
done
()
...
@@ -1657,6 +1663,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1657,6 +1663,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
}
}
}
}
}).
success
(
function
(
users
)
{
}).
success
(
function
(
users
)
{
expect
(
users
).
to
.
have
.
length
(
1
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo2'
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo2'
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
10
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
10
)
done
()
done
()
...
@@ -1672,6 +1679,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1672,6 +1679,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
intVal
:
10
intVal
:
10
}
}
}).
success
(
function
(
users
)
{
}).
success
(
function
(
users
)
{
expect
(
users
).
to
.
have
.
length
(
1
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo2'
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo2'
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
10
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
10
)
done
()
done
()
...
@@ -1686,6 +1694,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1686,6 +1694,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
}
}
}
}
}).
success
(
function
(
users
)
{
}).
success
(
function
(
users
)
{
expect
(
users
).
to
.
have
.
length
(
1
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo'
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo'
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
5
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
5
)
done
()
done
()
...
@@ -1701,6 +1710,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1701,6 +1710,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
}
}
}
}
}).
success
(
function
(
users
)
{
}).
success
(
function
(
users
)
{
expect
(
users
).
to
.
have
.
length
(
1
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo'
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo'
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
5
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
5
)
done
()
done
()
...
@@ -1716,6 +1726,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1716,6 +1726,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
}
}
}
}
}).
success
(
function
(
users
)
{
}).
success
(
function
(
users
)
{
expect
(
users
).
to
.
have
.
length
(
1
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo'
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo'
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
5
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
5
)
done
()
done
()
...
@@ -1730,6 +1741,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1730,6 +1741,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
}
}
}
}
}).
success
(
function
(
users
)
{
}).
success
(
function
(
users
)
{
expect
(
users
).
to
.
have
.
length
(
1
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo2'
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo2'
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
10
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
10
)
done
()
done
()
...
@@ -1801,6 +1813,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1801,6 +1813,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
}
}
}
}
}).
success
(
function
(
users
)
{
}).
success
(
function
(
users
)
{
expect
(
users
).
to
.
have
.
length
(
1
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo'
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo'
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
5
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
5
)
done
()
done
()
...
@@ -1821,6 +1834,23 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1821,6 +1834,23 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
})
})
it
(
'should be able to find a row using not equal to null logic'
,
function
(
done
)
{
this
.
User
.
findAll
({
where
:
{
intVal
:
{
ne
:
null
}
}
}).
success
(
function
(
users
)
{
expect
(
users
).
to
.
have
.
length
(
2
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo'
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
5
)
expect
(
users
[
1
].
username
).
to
.
equal
(
'boo2'
)
expect
(
users
[
1
].
intVal
).
to
.
equal
(
10
)
done
()
})
})
it
(
'should be able to find multiple users with any of the special where logic properties'
,
function
(
done
)
{
it
(
'should be able to find multiple users with any of the special where logic properties'
,
function
(
done
)
{
this
.
User
.
findAll
({
this
.
User
.
findAll
({
where
:
{
where
:
{
...
@@ -1829,6 +1859,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1829,6 +1859,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
}
}
}
}
}).
success
(
function
(
users
)
{
}).
success
(
function
(
users
)
{
expect
(
users
).
to
.
have
.
length
(
2
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo'
)
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo'
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
5
)
expect
(
users
[
0
].
intVal
).
to
.
equal
(
5
)
expect
(
users
[
1
].
username
).
to
.
equal
(
'boo2'
)
expect
(
users
[
1
].
username
).
to
.
equal
(
'boo2'
)
...
...
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