Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DatabaseTest
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Øivind Haugerøy Larsson
DatabaseTest
Commits
a676ca5f
Commit
a676ca5f
authored
6 years ago
by
Øivind Haugerøy Larsson
Browse files
Options
Downloads
Patches
Plain Diff
updateTest
parent
a4e1b899
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#22822
failed with stages
in 58 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dao/persondao.js
+1
-4
1 addition, 4 deletions
dao/persondao.js
dao/persondao.test.js
+19
-0
19 additions, 0 deletions
dao/persondao.test.js
with
20 additions
and
4 deletions
dao/persondao.js
+
1
−
4
View file @
a676ca5f
...
...
@@ -23,12 +23,9 @@ module.exports = class PersonDao extends Dao {
}
updateOne
(
id
,
json
,
callback
)
{
var
val
=
[
json
.
navn
,
json
.
adresse
,
json
.
alder
,
id
];
super
.
query
(
"
update person set navn=?, adresse=?, alder=? where id=?
"
,
[
json
.
navn
],
[
json
.
adresse
],
[
json
.
alder
],
[
id
],
callback
)
}
...
...
This diff is collapsed.
Click to expand it.
dao/persondao.test.js
+
19
−
0
View file @
a676ca5f
...
...
@@ -75,5 +75,24 @@ test("get all persons from db", done => {
done
();
}
test
(
"
update person from db
"
,
done
=>
{
function
callback
(
status
,
data
)
{
personDao
.
getOne
(
2
,
getCallback
);
}
function
getCallback
(
status
,
data
)
{
console
.
log
(
"
Test callback: status=
"
+
status
+
"
, data=
"
+
JSON
.
stringify
(
data
)
);
expect
(
data
.
length
).
toBe
(
1
);
expect
(
data
[
0
].
alder
).
toBe
(
23
);
done
();
}
personDao
.
updateOne
(
2
,
{
navn
:
"
Hei Heisen
"
,
adresse
:
"
Gata 2
"
,
alder
:
"
23
"
},
callback
);
})
personDao
.
getAll
(
callback
);
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment