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 29c1ac01
authored
Oct 14, 2012
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed the context of the selectQuery tests
1 parent
1fa63824
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
13 deletions
spec-jasmine/mysql/query-generator.spec.js
spec-jasmine/mysql/query-generator.spec.js
View file @
29c1ac0
...
@@ -35,44 +35,57 @@ describe('QueryGenerator', function() {
...
@@ -35,44 +35,57 @@ describe('QueryGenerator', function() {
selectQuery
:
[
selectQuery
:
[
{
{
arguments
:
[
'myTable'
],
arguments
:
[
'myTable'
],
expectation
:
"SELECT * FROM `myTable`;"
expectation
:
"SELECT * FROM `myTable`;"
,
context
:
QueryGenerator
},
{
},
{
arguments
:
[
'myTable'
,
{
attributes
:
[
'id'
,
'name'
]}],
arguments
:
[
'myTable'
,
{
attributes
:
[
'id'
,
'name'
]}],
expectation
:
"SELECT `id`, `name` FROM `myTable`;"
expectation
:
"SELECT `id`, `name` FROM `myTable`;"
,
context
:
QueryGenerator
},
{
},
{
arguments
:
[
'myTable'
,
{
where
:
{
id
:
2
}}],
arguments
:
[
'myTable'
,
{
where
:
{
id
:
2
}}],
expectation
:
"SELECT * FROM `myTable` WHERE `myTable`.`id`=2;"
expectation
:
"SELECT * FROM `myTable` WHERE `myTable`.`id`=2;"
,
context
:
QueryGenerator
},
{
},
{
arguments
:
[
'myTable'
,
{
where
:
{
name
:
'foo'
}}],
arguments
:
[
'myTable'
,
{
where
:
{
name
:
'foo'
}}],
expectation
:
"SELECT * FROM `myTable` WHERE `myTable`.`name`='foo';"
expectation
:
"SELECT * FROM `myTable` WHERE `myTable`.`name`='foo';"
,
context
:
QueryGenerator
},
{
},
{
arguments
:
[
'myTable'
,
{
where
:
{
name
:
"foo';DROP TABLE myTable;"
}}],
arguments
:
[
'myTable'
,
{
where
:
{
name
:
"foo';DROP TABLE myTable;"
}}],
expectation
:
"SELECT * FROM `myTable` WHERE `myTable`.`name`='foo\\';DROP TABLE myTable;';"
expectation
:
"SELECT * FROM `myTable` WHERE `myTable`.`name`='foo\\';DROP TABLE myTable;';"
,
context
:
QueryGenerator
},
{
},
{
arguments
:
[
'myTable'
,
{
where
:
2
}],
arguments
:
[
'myTable'
,
{
where
:
2
}],
expectation
:
"SELECT * FROM `myTable` WHERE `myTable`.`id`=2;"
expectation
:
"SELECT * FROM `myTable` WHERE `myTable`.`id`=2;"
,
context
:
QueryGenerator
},
{
},
{
arguments
:
[
'foo'
,
{
attributes
:
[[
'count(*)'
,
'count'
]]
}],
arguments
:
[
'foo'
,
{
attributes
:
[[
'count(*)'
,
'count'
]]
}],
expectation
:
'SELECT count(*) as `count` FROM `foo`;'
expectation
:
'SELECT count(*) as `count` FROM `foo`;'
,
context
:
QueryGenerator
},
{
},
{
arguments
:
[
'myTable'
,
{
where
:
"foo='bar'"
}],
arguments
:
[
'myTable'
,
{
where
:
"foo='bar'"
}],
expectation
:
"SELECT * FROM `myTable` WHERE foo='bar';"
expectation
:
"SELECT * FROM `myTable` WHERE foo='bar';"
,
context
:
QueryGenerator
},
{
},
{
arguments
:
[
'myTable'
,
{
order
:
"id DESC"
}],
arguments
:
[
'myTable'
,
{
order
:
"id DESC"
}],
expectation
:
"SELECT * FROM `myTable` ORDER BY id DESC;"
expectation
:
"SELECT * FROM `myTable` ORDER BY id DESC;"
,
context
:
QueryGenerator
},
{
},
{
arguments
:
[
'myTable'
,
{
group
:
"name"
}],
arguments
:
[
'myTable'
,
{
group
:
"name"
}],
expectation
:
"SELECT * FROM `myTable` GROUP BY `name`;"
expectation
:
"SELECT * FROM `myTable` GROUP BY `name`;"
,
context
:
QueryGenerator
},
{
},
{
arguments
:
[
'myTable'
,
{
limit
:
10
}],
arguments
:
[
'myTable'
,
{
limit
:
10
}],
expectation
:
"SELECT * FROM `myTable` LIMIT 10;"
expectation
:
"SELECT * FROM `myTable` LIMIT 10;"
,
context
:
QueryGenerator
},
{
},
{
arguments
:
[
'myTable'
,
{
limit
:
10
,
offset
:
2
}],
arguments
:
[
'myTable'
,
{
limit
:
10
,
offset
:
2
}],
expectation
:
"SELECT * FROM `myTable` LIMIT 2, 10;"
expectation
:
"SELECT * FROM `myTable` LIMIT 2, 10;"
,
context
:
QueryGenerator
},
{
},
{
title
:
'ignores offset if no limit was passed'
,
title
:
'ignores offset if no limit was passed'
,
arguments
:
[
'myTable'
,
{
offset
:
2
}],
arguments
:
[
'myTable'
,
{
offset
:
2
}],
expectation
:
"SELECT * FROM `myTable`;"
expectation
:
"SELECT * FROM `myTable`;"
,
context
:
QueryGenerator
}
}
],
],
...
...
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