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 ae55f6ba
authored
Jun 02, 2012
by
Eugene Korbut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test case for sqlite quoting
1 parent
c5c1bb74
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
spec-jasmine/sqlite/query-generator.spec.js
spec-jasmine/sqlite/query-generator.spec.js
0 → 100644
View file @
ae55f6b
var
Sequelize
=
require
(
"../../index"
)
,
sequelize
=
new
Sequelize
(
null
,
null
,
null
,
{
dialect
:
'sqlite'
})
,
Helpers
=
new
(
require
(
"../config/helpers"
))(
sequelize
)
,
QueryGenerator
=
require
(
"../../lib/dialects/sqlite/query-generator"
)
,
util
=
require
(
"util"
);
describe
(
'QueryGenerator'
,
function
()
{
beforeEach
(
function
()
{
Helpers
.
sync
()
})
afterEach
(
function
()
{
Helpers
.
drop
()
})
var
suites
=
{
insertQuery
:
[
{
arguments
:
[
'myTable'
,
{
name
:
'foo'
}],
expectation
:
"INSERT INTO `myTable` (`name`) VALUES ('foo');"
},
{
arguments
:
[
'myTable'
,
{
name
:
"'bar'"
}],
expectation
:
"INSERT INTO `myTable` (`name`) VALUES ('''bar''');"
}
],
updateQuery
:
[
{
arguments
:
[
'myTable'
,
{
name
:
'foo'
},
{
id
:
2
}],
expectation
:
"UPDATE `myTable` SET `name`='foo' WHERE `id`=2"
},
{
arguments
:
[
'myTable'
,
{
name
:
"'bar'"
},
{
id
:
2
}],
expectation
:
"UPDATE `myTable` SET `name`='''bar''' WHERE `id`=2"
}
]
};
Sequelize
.
Utils
.
_
.
each
(
suites
,
function
(
tests
,
suiteTitle
)
{
describe
(
suiteTitle
,
function
()
{
tests
.
forEach
(
function
(
test
)
{
var
title
=
test
.
title
||
'correctly returns '
+
test
.
expectation
+
' for '
+
util
.
inspect
(
test
.
arguments
)
it
(
title
,
function
()
{
var
conditions
=
QueryGenerator
[
suiteTitle
].
apply
(
null
,
test
.
arguments
)
expect
(
conditions
).
toEqual
(
test
.
expectation
)
})
})
})
})
});
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