Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DatabaseTest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
Mahmoud Ibrahim Mohammad
DatabaseTest
Commits
b22719f8
Commit
b22719f8
authored
5 years ago
by
Mahmoud Ibrahim Mohammad
Browse files
Options
Downloads
Patches
Plain Diff
Testing update and delete person
parent
ebabd76b
Branches
master
No related tags found
No related merge requests found
Pipeline
#49677
canceled
5 years ago
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dao/persondao.js
+1
-7
1 addition, 7 deletions
dao/persondao.js
dao/persondao.test.js
+5
-5
5 additions, 5 deletions
dao/persondao.test.js
server.js
+1
-7
1 addition, 7 deletions
server.js
with
7 additions
and
19 deletions
dao/persondao.js
+
1
−
7
View file @
b22719f8
...
...
@@ -22,11 +22,10 @@ module.exports = class PersonDao extends Dao {
);
}
updateOne
(
id
,
nyNav
n
,
callback
)
{
updateOne
(
jso
n
,
callback
)
{
super
.
query
(
"
update person set navn=nynavn where id=?
"
,
[
id
],
[
nyNavn
],
callback
);
}
...
...
@@ -37,9 +36,4 @@ module.exports = class PersonDao extends Dao {
callback
);
}
countAll
(
callback
){
super
.
query
(
"
SELECT COUNT(*) FROM person;
"
,[],
callback
)
}
};
This diff is collapsed.
Click to expand it.
dao/persondao.test.js
+
5
−
5
View file @
b22719f8
...
...
@@ -83,20 +83,20 @@ test("oppdater person to db", done => {
console
.
log
(
"
Test callback: status=
"
+
status
+
"
, data=
"
+
JSON
.
stringify
(
data
)
);
expect
(
data
.
affectedRows
).
to
Be
(
1
);
expect
(
data
.
affectedRows
).
to
Equal
(
1
);
done
();
}
personDao
.
updateOne
(
2
,{
navn
:
"
Mahmoud
"
}
,
callback
);
personDao
.
updateOne
(
{
navn
:
"
mahmoud
"
,
id
:
"
2
"
}
,
callback
);
});
test
(
"
slett person to db
"
,
done
=>
{
function
callback
(
status
)
{
function
callback
(
status
,
data
)
{
console
.
log
(
"
Test callback: status=
"
+
status
+
"
, data=
"
+
JSON
.
stringify
(
data
)
);
expect
(
personDao
.
countAll
((
status
,
data
))).
to
Equal
(
1
);
expect
(
data
.
affectedRows
).
toBeGreaterThanOr
Equal
(
1
);
done
();
}
...
...
This diff is collapsed.
Click to expand it.
server.js
+
1
−
7
View file @
b22719f8
...
...
@@ -57,12 +57,6 @@ app.delete("/person/:personId", (req, res) => {
});
});
app
.
get
(
"
/person
"
,
(
req
,
res
)
=>
{
console
.
log
(
"
/person: fikk request fra klient
"
);
personDao
.
countAll
((
status
,
data
)
=>
{
res
.
status
(
status
);
res
.
json
(
data
);
});
});
var
server
=
app
.
listen
(
8080
);
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