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 41676e2b
authored
Nov 06, 2014
by
Seth Samuel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecssarily asynchronous tests
1 parent
d7d44e17
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
30 deletions
test/postgres/hstore.test.js
test/postgres/hstore.test.js
View file @
41676e2
...
@@ -10,19 +10,16 @@ chai.config.includeStack = true
...
@@ -10,19 +10,16 @@ chai.config.includeStack = true
if
(
dialect
.
match
(
/^postgres/
))
{
if
(
dialect
.
match
(
/^postgres/
))
{
describe
(
'[POSTGRES Specific] hstore'
,
function
()
{
describe
(
'[POSTGRES Specific] hstore'
,
function
()
{
describe
(
'stringify'
,
function
()
{
describe
(
'stringify'
,
function
()
{
it
(
'should handle empty objects correctly'
,
function
(
done
)
{
it
(
'should handle empty objects correctly'
,
function
()
{
expect
(
hstore
.
stringify
({
})).
to
.
equal
(
''
)
expect
(
hstore
.
stringify
({
})).
to
.
equal
(
''
)
done
()
})
})
it
(
'should handle null values correctly'
,
function
(
done
)
{
it
(
'should handle null values correctly'
,
function
()
{
expect
(
hstore
.
stringify
({
null
:
null
})).
to
.
equal
(
'"null"=>NULL'
)
expect
(
hstore
.
stringify
({
null
:
null
})).
to
.
equal
(
'"null"=>NULL'
)
done
()
})
})
it
(
'should handle null values correctly'
,
function
(
done
)
{
it
(
'should handle null values correctly'
,
function
()
{
expect
(
hstore
.
stringify
({
foo
:
null
})).
to
.
equal
(
'"foo"=>NULL'
)
expect
(
hstore
.
stringify
({
foo
:
null
})).
to
.
equal
(
'"foo"=>NULL'
)
done
()
})
})
it
(
'should handle empty string correctly'
,
function
(
done
)
{
it
(
'should handle empty string correctly'
,
function
(
done
)
{
...
@@ -30,71 +27,59 @@ if (dialect.match(/^postgres/)) {
...
@@ -30,71 +27,59 @@ if (dialect.match(/^postgres/)) {
done
()
done
()
})
})
it
(
'should handle a string with backslashes correctly'
,
function
(
done
)
{
it
(
'should handle a string with backslashes correctly'
,
function
()
{
expect
(
hstore
.
stringify
({
foo
:
"\\"
})).
to
.
equal
(
'"foo"=>"\\\\"'
)
expect
(
hstore
.
stringify
({
foo
:
"\\"
})).
to
.
equal
(
'"foo"=>"\\\\"'
)
done
()
})
})
it
(
'should handle a string with double quotes correctly'
,
function
(
done
)
{
it
(
'should handle a string with double quotes correctly'
,
function
()
{
expect
(
hstore
.
stringify
({
foo
:
'""a"'
})).
to
.
equal
(
'"foo"=>"\\"\\"a\\""'
)
expect
(
hstore
.
stringify
({
foo
:
'""a"'
})).
to
.
equal
(
'"foo"=>"\\"\\"a\\""'
)
done
()
})
})
it
(
'should handle a string with single quotes correctly'
,
function
(
done
)
{
it
(
'should handle a string with single quotes correctly'
,
function
()
{
expect
(
hstore
.
stringify
({
foo
:
"''a'"
})).
to
.
equal
(
'"foo"=>"\'\'\'\'a\'\'"'
)
expect
(
hstore
.
stringify
({
foo
:
"''a'"
})).
to
.
equal
(
'"foo"=>"\'\'\'\'a\'\'"'
)
done
()
})
})
it
(
'should handle simple objects correctly'
,
function
(
done
)
{
it
(
'should handle simple objects correctly'
,
function
()
{
expect
(
hstore
.
stringify
({
test
:
'value'
})).
to
.
equal
(
'"test"=>"value"'
)
expect
(
hstore
.
stringify
({
test
:
'value'
})).
to
.
equal
(
'"test"=>"value"'
)
done
()
})
})
})
})
describe
(
'parse'
,
function
()
{
describe
(
'parse'
,
function
()
{
it
(
'should handle a null object correctly'
,
function
(
done
)
{
it
(
'should handle a null object correctly'
,
function
()
{
expect
(
hstore
.
parse
(
null
)).
to
.
deep
.
equal
(
null
)
expect
(
hstore
.
parse
(
null
)).
to
.
deep
.
equal
(
null
)
done
()
})
})
it
(
'should handle empty string correctly'
,
function
(
done
)
{
it
(
'should handle empty string correctly'
,
function
()
{
expect
(
hstore
.
parse
(
'"foo"=>\"\"'
)).
to
.
deep
.
equal
({
foo
:
""
})
expect
(
hstore
.
parse
(
'"foo"=>\"\"'
)).
to
.
deep
.
equal
({
foo
:
""
})
done
()
})
})
it
(
'should handle a string with double quotes correctly'
,
function
(
done
)
{
it
(
'should handle a string with double quotes correctly'
,
function
()
{
expect
(
hstore
.
parse
(
'"foo"=>"\\\"\\\"a\\\""'
)).
to
.
deep
.
equal
({
foo
:
"\"\"a\""
})
expect
(
hstore
.
parse
(
'"foo"=>"\\\"\\\"a\\\""'
)).
to
.
deep
.
equal
({
foo
:
"\"\"a\""
})
done
()
})
})
it
(
'should handle a string with single quotes correctly'
,
function
(
done
)
{
it
(
'should handle a string with single quotes correctly'
,
function
()
{
expect
(
hstore
.
parse
(
'"foo"=>"\'\'\'\'a\'\'"'
)).
to
.
deep
.
equal
({
foo
:
"''a'"
})
expect
(
hstore
.
parse
(
'"foo"=>"\'\'\'\'a\'\'"'
)).
to
.
deep
.
equal
({
foo
:
"''a'"
})
done
()
})
})
it
(
'should handle a string with backslashes correctly'
,
function
(
done
)
{
it
(
'should handle a string with backslashes correctly'
,
function
()
{
expect
(
hstore
.
parse
(
'"foo"=>"\\\\"'
)).
to
.
deep
.
equal
({
foo
:
"\\"
})
expect
(
hstore
.
parse
(
'"foo"=>"\\\\"'
)).
to
.
deep
.
equal
({
foo
:
"\\"
})
done
()
})
})
it
(
'should handle empty objects correctly'
,
function
(
done
)
{
it
(
'should handle empty objects correctly'
,
function
()
{
expect
(
hstore
.
parse
(
''
)).
to
.
deep
.
equal
({
})
expect
(
hstore
.
parse
(
''
)).
to
.
deep
.
equal
({
})
done
()
})
})
it
(
'should handle simple objects correctly'
,
function
(
done
)
{
it
(
'should handle simple objects correctly'
,
function
()
{
expect
(
hstore
.
parse
(
'"test"=>"value"'
)).
to
.
deep
.
equal
({
test
:
'value'
})
expect
(
hstore
.
parse
(
'"test"=>"value"'
)).
to
.
deep
.
equal
({
test
:
'value'
})
done
()
})
})
})
})
describe
(
'stringify and parse'
,
function
()
{
describe
(
'stringify and parse'
,
function
()
{
it
(
'should stringify then parse back the same structure'
,
function
(
done
){
it
(
'should stringify then parse back the same structure'
,
function
(){
var
testObj
=
{
foo
:
"bar"
,
count
:
"1"
,
emptyString
:
""
,
quotyString
:
'""'
,
extraQuotyString
:
'"""a"""""'
,
backslashes
:
'\\f023'
,
moreBackslashes
:
'\\f\\0\\2\\1'
,
backslashesAndQuotes
:
'\\"\\"uhoh"\\"'
,
nully
:
null
};
var
testObj
=
{
foo
:
"bar"
,
count
:
"1"
,
emptyString
:
""
,
quotyString
:
'""'
,
extraQuotyString
:
'"""a"""""'
,
backslashes
:
'\\f023'
,
moreBackslashes
:
'\\f\\0\\2\\1'
,
backslashesAndQuotes
:
'\\"\\"uhoh"\\"'
,
nully
:
null
};
expect
(
hstore
.
parse
(
hstore
.
stringify
(
testObj
))).
to
.
deep
.
equal
(
testObj
);
expect
(
hstore
.
parse
(
hstore
.
stringify
(
testObj
))).
to
.
deep
.
equal
(
testObj
);
expect
(
hstore
.
parse
(
hstore
.
stringify
(
hstore
.
parse
(
hstore
.
stringify
(
testObj
))))).
to
.
deep
.
equal
(
testObj
);
expect
(
hstore
.
parse
(
hstore
.
stringify
(
hstore
.
parse
(
hstore
.
stringify
(
testObj
))))).
to
.
deep
.
equal
(
testObj
);
done
()
})
})
})
})
})
})
...
...
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