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 07510193
authored
Sep 20, 2014
by
overlookmotel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Amended tests for changed findAll error handling
1 parent
5fccccb4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
48 deletions
test/dao-factory/find.test.js
test/dao-factory/findAll.test.js
test/dao-factory/find.test.js
View file @
0751019
...
...
@@ -332,19 +332,19 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
describe
(
'generic'
,
function
()
{
it
(
'throws an error about unexpected input if include contains a non-object'
,
function
(
done
)
{
var
self
=
this
expect
(
function
()
{
self
.
Worker
.
find
({
include
:
[
1
]
})
}).
to
.
throw
(
Error
)
self
.
Worker
.
find
({
include
:
[
1
]
}).
catch
(
function
(
err
)
{
expect
(
err
.
message
).
to
.
equal
(
'Include unexpected. Element has to be either a Model, an Association or an object.'
);
done
()
})
})
it
(
'throws an error if included DaoFactory is not associated'
,
function
(
done
)
{
var
self
=
this
expect
(
function
()
{
self
.
Worker
.
find
({
include
:
[
self
.
Task
]
})
}).
to
.
throw
(
Error
,
'Task is not associated to Worker!'
)
self
.
Worker
.
find
({
include
:
[
self
.
Task
]
}).
catch
(
function
(
err
)
{
expect
(
err
.
message
).
to
.
equal
(
'Task is not associated to Worker!'
);
done
()
})
})
it
(
'returns the associated worker via task.worker'
,
function
(
done
)
{
var
self
=
this
...
...
@@ -518,11 +518,11 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it
(
'throws an error if included DaoFactory is not associated'
,
function
(
done
)
{
var
self
=
this
expect
(
function
()
{
self
.
Task
.
find
({
include
:
[
self
.
Worker
]
})
}).
to
.
throw
(
Error
,
'Worker is not associated to Task!'
)
self
.
Task
.
find
({
include
:
[
self
.
Worker
]
}).
catch
(
function
(
err
)
{
expect
(
err
.
message
).
to
.
equal
(
'Worker is not associated to Task!'
);
done
()
})
})
it
(
'returns the associated task via worker.task'
,
function
(
done
)
{
this
.
Worker
.
find
({
...
...
@@ -577,11 +577,11 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
describe
(
'hasOne with alias'
,
function
()
{
it
(
'throws an error if included DaoFactory is not referenced by alias'
,
function
(
done
)
{
var
self
=
this
expect
(
function
()
{
self
.
Worker
.
find
({
include
:
[
self
.
Task
]
})
}).
to
.
throw
(
Error
,
'Task is not associated to Worker!'
)
self
.
Worker
.
find
({
include
:
[
self
.
Task
]
}).
catch
(
function
(
err
)
{
expect
(
err
.
message
).
to
.
equal
(
'Task is not associated to Worker!'
);
done
()
})
})
describe
(
'alias'
,
function
()
{
beforeEach
(
function
(
done
)
{
...
...
@@ -596,11 +596,11 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it
(
'throws an error if alias is not associated'
,
function
(
done
)
{
var
self
=
this
expect
(
function
()
{
self
.
Worker
.
find
({
include
:
[
{
daoFactory
:
self
.
Task
,
as
:
'Work'
}
]
})
}).
to
.
throw
(
Error
,
'Task (Work) is not associated to Worker!'
)
self
.
Worker
.
find
({
include
:
[
{
daoFactory
:
self
.
Task
,
as
:
'Work'
}
]
}).
catch
(
function
(
err
)
{
expect
(
err
.
message
).
to
.
equal
(
'Task (Work) is not associated to Worker!'
);
done
()
})
})
it
(
'returns the associated task via worker.task'
,
function
(
done
)
{
this
.
Worker
.
find
({
...
...
@@ -657,11 +657,11 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it
(
'throws an error if included DaoFactory is not associated'
,
function
(
done
)
{
var
self
=
this
expect
(
function
()
{
self
.
Task
.
find
({
include
:
[
self
.
Worker
]
})
}).
to
.
throw
(
Error
,
'Worker is not associated to Task!'
)
self
.
Task
.
find
({
include
:
[
self
.
Worker
]
}).
catch
(
function
(
err
)
{
expect
(
err
.
message
).
to
.
equal
(
'Worker is not associated to Task!'
);
done
()
})
})
it
(
'returns the associated tasks via worker.tasks'
,
function
(
done
)
{
this
.
Worker
.
find
({
...
...
@@ -759,11 +759,11 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
describe
(
'hasMany with alias'
,
function
()
{
it
(
'throws an error if included DaoFactory is not referenced by alias'
,
function
(
done
)
{
var
self
=
this
expect
(
function
()
{
self
.
Worker
.
find
({
include
:
[
self
.
Task
]
})
}).
to
.
throw
(
Error
,
'Task is not associated to Worker!'
)
self
.
Worker
.
find
({
include
:
[
self
.
Task
]
}).
catch
(
function
(
err
)
{
expect
(
err
.
message
).
to
.
equal
(
'Task is not associated to Worker!'
);
done
()
})
})
describe
(
'alias'
,
function
()
{
beforeEach
(
function
(
done
)
{
...
...
@@ -778,11 +778,11 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it
(
'throws an error if alias is not associated'
,
function
(
done
)
{
var
self
=
this
expect
(
function
()
{
self
.
Worker
.
find
({
include
:
[
{
daoFactory
:
self
.
Task
,
as
:
'Work'
}
]
})
}).
to
.
throw
(
Error
,
'Task (Work) is not associated to Worker!'
)
self
.
Worker
.
find
({
include
:
[
{
daoFactory
:
self
.
Task
,
as
:
'Work'
}
]
}).
catch
(
function
(
err
)
{
expect
(
err
.
message
).
to
.
equal
(
'Task (Work) is not associated to Worker!'
);
done
()
})
})
it
(
'returns the associated task via worker.task'
,
function
(
done
)
{
this
.
Worker
.
find
({
...
...
test/dao-factory/findAll.test.js
View file @
0751019
...
...
@@ -575,19 +575,19 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it
(
'throws an error about unexpected input if include contains a non-object'
,
function
(
done
)
{
var
self
=
this
expect
(
function
()
{
self
.
Worker
.
all
({
include
:
[
1
]
})
}).
to
.
throw
(
Error
)
self
.
Worker
.
all
({
include
:
[
1
]
}).
catch
(
function
(
err
)
{
expect
(
err
.
message
).
to
.
equal
(
'Include unexpected. Element has to be either a Model, an Association or an object.'
);
done
()
})
})
it
(
'throws an error if included DaoFactory is not associated'
,
function
(
done
)
{
var
self
=
this
expect
(
function
()
{
self
.
Worker
.
all
({
include
:
[
self
.
Task
]
})
}).
to
.
throw
(
Error
,
'TaskBelongsTo is not associated to Worker!'
)
self
.
Worker
.
all
({
include
:
[
self
.
Task
]
}).
catch
(
function
(
err
)
{
expect
(
err
.
message
).
to
.
equal
(
'TaskBelongsTo is not associated to Worker!'
);
done
()
})
})
it
(
'returns the associated worker via task.worker'
,
function
(
done
)
{
this
.
Task
.
all
({
...
...
@@ -627,11 +627,11 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it
(
'throws an error if included DaoFactory is not associated'
,
function
(
done
)
{
var
self
=
this
expect
(
function
()
{
self
.
Task
.
all
({
include
:
[
self
.
Worker
]
})
}).
to
.
throw
(
Error
,
'Worker is not associated to TaskHasOne!'
)
self
.
Task
.
all
({
include
:
[
self
.
Worker
]
}).
catch
(
function
(
err
)
{
expect
(
err
.
message
).
to
.
equal
(
'Worker is not associated to TaskHasOne!'
);
done
()
})
})
it
(
'returns the associated task via worker.task'
,
function
(
done
)
{
this
.
Worker
.
all
({
...
...
@@ -672,19 +672,19 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it
(
'throws an error if included DaoFactory is not referenced by alias'
,
function
(
done
)
{
var
self
=
this
expect
(
function
()
{
self
.
Worker
.
all
({
include
:
[
self
.
Task
]
})
}).
to
.
throw
(
Error
,
'Task is not associated to Worker!'
)
self
.
Worker
.
all
({
include
:
[
self
.
Task
]
}).
catch
(
function
(
err
)
{
expect
(
err
.
message
).
to
.
equal
(
'Task is not associated to Worker!'
);
done
()
})
})
it
(
'throws an error if alias is not associated'
,
function
(
done
)
{
var
self
=
this
expect
(
function
()
{
self
.
Worker
.
all
({
include
:
[
{
daoFactory
:
self
.
Task
,
as
:
'Work'
}
]
})
}).
to
.
throw
(
Error
,
'Task (Work) is not associated to Worker!'
)
self
.
Worker
.
all
({
include
:
[
{
daoFactory
:
self
.
Task
,
as
:
'Work'
}
]
}).
catch
(
function
(
err
)
{
expect
(
err
.
message
).
to
.
equal
(
'Task (Work) is not associated to Worker!'
);
done
()
})
})
it
(
'returns the associated task via worker.task'
,
function
(
done
)
{
this
.
Worker
.
all
({
...
...
@@ -735,11 +735,11 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it
(
'throws an error if included DaoFactory is not associated'
,
function
(
done
)
{
var
self
=
this
expect
(
function
()
{
self
.
Task
.
findAll
({
include
:
[
self
.
Worker
]
})
}).
to
.
throw
(
Error
,
'worker is not associated to task!'
)
self
.
Task
.
findAll
({
include
:
[
self
.
Worker
]
}).
catch
(
function
(
err
)
{
expect
(
err
.
message
).
to
.
equal
(
'worker is not associated to task!'
);
done
()
})
})
it
(
'returns the associated tasks via worker.tasks'
,
function
(
done
)
{
this
.
Worker
.
findAll
({
...
...
@@ -780,19 +780,19 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it
(
'throws an error if included DaoFactory is not referenced by alias'
,
function
(
done
)
{
var
self
=
this
expect
(
function
()
{
self
.
Worker
.
findAll
({
include
:
[
self
.
Task
]
})
}).
to
.
throw
(
Error
,
'Task is not associated to Worker!'
)
self
.
Worker
.
findAll
({
include
:
[
self
.
Task
]
}).
catch
(
function
(
err
)
{
expect
(
err
.
message
).
to
.
equal
(
'Task is not associated to Worker!'
);
done
()
})
})
it
(
'throws an error if alias is not associated'
,
function
(
done
)
{
var
self
=
this
expect
(
function
()
{
self
.
Worker
.
findAll
({
include
:
[
{
daoFactory
:
self
.
Task
,
as
:
'Work'
}
]
})
}).
to
.
throw
(
Error
,
'Task (Work) is not associated to Worker!'
)
self
.
Worker
.
findAll
({
include
:
[
{
daoFactory
:
self
.
Task
,
as
:
'Work'
}
]
}).
catch
(
function
(
err
)
{
expect
(
err
.
message
).
to
.
equal
(
'Task (Work) is not associated to Worker!'
);
done
()
})
})
it
(
'returns the associated task via worker.task'
,
function
(
done
)
{
this
.
Worker
.
findAll
({
...
...
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