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 3ca87eb9
authored
Jun 13, 2016
by
Sushant
Committed by
Mick Hansen
Jun 13, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(test) findAndCountAll regression with sequelize.or (#6078)
1 parent
4c9e77fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
test/integration/include/findAndCountAll.test.js
test/integration/include/findAndCountAll.test.js
View file @
3ca87eb
...
@@ -292,5 +292,57 @@ describe(Support.getTestDialectTeaser('Include'), function() {
...
@@ -292,5 +292,57 @@ describe(Support.getTestDialectTeaser('Include'), function() {
expect
(
result
.
rows
.
length
).
to
.
equal
(
1
);
expect
(
result
.
rows
.
length
).
to
.
equal
(
1
);
});
});
});
});
it
(
'should properly work with sequelize.function'
,
function
()
{
var
sequelize
=
this
.
sequelize
;
var
User
=
this
.
sequelize
.
define
(
'User'
,
{
id
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
false
,
primaryKey
:
true
,
autoIncrement
:
true
},
first_name
:
{
type
:
DataTypes
.
STRING
},
last_name
:
{
type
:
DataTypes
.
STRING
}
});
var
Project
=
this
.
sequelize
.
define
(
'Project'
,
{
id
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
false
,
primaryKey
:
true
,
autoIncrement
:
true
},
name
:
{
type
:
DataTypes
.
STRING
}
});
User
.
hasMany
(
Project
);
return
this
.
sequelize
.
sync
({
force
:
true
}).
then
(
function
()
{
return
User
.
bulkCreate
([
{
first_name
:
'user-fname-1'
,
last_name
:
'user-lname-1'
},
{
first_name
:
'user-fname-2'
,
last_name
:
'user-lname-2'
},
{
first_name
:
'user-xfname-1'
,
last_name
:
'user-xlname-1'
}
]);
}).
then
(
function
(
u
)
{
return
Project
.
bulkCreate
([
{
name
:
'naam-satya'
,
UserId
:
1
},
{
name
:
'guru-satya'
,
UserId
:
2
},
{
name
:
'app-satya'
,
UserId
:
2
}
]);
}).
then
(
function
()
{
return
User
.
findAndCountAll
({
limit
:
1
,
offset
:
1
,
where
:
sequelize
.
or
(
{
first_name
:
{
like
:
'%user-fname%'
}
},
{
last_name
:
{
like
:
'%user-lname%'
}
}
),
include
:
[
{
model
:
Project
,
required
:
true
,
where
:
{
name
:
{
$in
:
[
'naam-satya'
,
'guru-satya'
]
}}
}
]
});
}).
then
(
function
(
result
)
{
expect
(
result
.
count
).
to
.
equal
(
2
);
expect
(
result
.
rows
.
length
).
to
.
equal
(
1
);
});
});
});
});
});
});
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