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 cd1206b1
authored
Feb 09, 2015
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change JSON unit test to use dialect.supports
1 parent
69ab3165
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
7 deletions
lib/dialects/abstract/index.js
lib/dialects/postgres/index.js
test/unit/sql/json.test.js
lib/dialects/abstract/index.js
View file @
cd1206b
...
...
@@ -45,7 +45,8 @@ AbstractDialect.prototype.supports = {
type
:
false
,
using
:
true
,
},
joinTableDependent
:
true
joinTableDependent
:
true
,
JSON
:
false
,
};
module
.
exports
=
AbstractDialect
;
lib/dialects/postgres/index.js
View file @
cd1206b
...
...
@@ -33,7 +33,8 @@ PostgresDialect.prototype.supports = _.merge(_.cloneDeep(Abstract.prototype.supp
index
:
{
concurrently
:
true
,
using
:
2
,
}
},
JSON
:
true
,
});
PostgresDialect
.
prototype
.
Query
=
Query
;
...
...
test/unit/sql/json.test.js
View file @
cd1206b
...
...
@@ -5,28 +5,29 @@ var Support = require(__dirname + '/../support')
,
util
=
require
(
'util'
)
,
expectsql
=
Support
.
expectsql
,
current
=
Support
.
sequelize
,
sql
=
current
.
dialect
.
QueryGenerator
;
,
sql
=
current
.
dialect
.
QueryGenerator
,
current
=
Support
.
sequelize
;
// Notice: [] will be replaced by dialect specific tick/quote character when there is not dialect specific expectation but only a default expectation
if
(
Support
.
getTestDialect
()
===
'postgres'
)
{
if
(
current
.
dialect
.
supports
.
JSON
)
{
suite
(
Support
.
getTestDialectTeaser
(
'SQL'
),
function
()
{
suite
(
'JSON'
,
function
()
{
suite
(
'escape'
,
function
()
{
test
(
'plain string'
,
function
()
{
expectsql
(
sql
.
escape
(
'string'
,
{
type
:
DataTypes
.
JSON
}),
{
expectsql
(
sql
.
escape
(
'string'
,
{
type
:
new
DataTypes
.
JSON
()
}),
{
default
:
'\'"string"\''
});
});
test
(
'plain int'
,
function
()
{
expectsql
(
sql
.
escape
(
123
,
{
type
:
DataTypes
.
JSON
}),
{
expectsql
(
sql
.
escape
(
123
,
{
type
:
new
DataTypes
.
JSON
()
}),
{
default
:
"'123'"
});
});
test
(
'nested object'
,
function
()
{
expectsql
(
sql
.
escape
({
some
:
'nested'
,
more
:
{
nested
:
true
},
answer
:
42
},
{
type
:
DataTypes
.
JSON
}),
{
expectsql
(
sql
.
escape
({
some
:
'nested'
,
more
:
{
nested
:
true
},
answer
:
42
},
{
type
:
new
DataTypes
.
JSON
()
}),
{
default
:
"'{\"some\":\"nested\",\"more\":{\"nested\":true},\"answer\":42}'"
});
});
...
...
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