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
Herman Christiansen
DatabaseTest
Commits
8176cd37
Commit
8176cd37
authored
6 years ago
by
nilstes
Browse files
Options
Downloads
Patches
Plain Diff
feilsok
parent
9004fe1b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+2
-2
2 additions, 2 deletions
.gitlab-ci.yml
dao/persondao.test.js
+15
-13
15 additions, 13 deletions
dao/persondao.test.js
with
17 additions
and
15 deletions
.gitlab-ci.yml
+
2
−
2
View file @
8176cd37
image
:
node:
6
image
:
node:
8
# Set up MySQL test-database
services
:
...
...
@@ -6,7 +6,7 @@ services:
# Configure test-database
variables
:
MYSQL_DATABASE
:
db
MYSQL_DATABASE
:
supertest
db
MYSQL_ROOT_PASSWORD
:
secret
# Install node libraries
...
...
This diff is collapsed.
Click to expand it.
dao/persondao.test.js
+
15
−
13
View file @
8176cd37
...
...
@@ -5,33 +5,35 @@ var pool = mysql.createPool({
host
:
"
mysql
"
,
user
:
"
root
"
,
password
:
"
secret
"
,
database
:
"
db
"
,
database
:
"
supertest
db
"
,
debug
:
false
});
test
(
"
query db
"
,
()
=>
{
test
(
"
query db
"
,
done
=>
{
console
.
log
(
"
Connecting to database
"
);
/* pool.getConnection((err, connection) => {
function
callback
(
data
)
{
console
.
log
(
"
Callback:
"
+
data
);
expect
(
data
).
toBe
(
"
SUCCESS
"
);
done
();
}
pool
.
getConnection
((
err
,
connection
)
=>
{
console
.
log
(
"
Connected to database
"
);
if
(
err
)
{
console.log("Feil ved kobling til databasen");
res.json({ error: "feil ved ved oppkobling" });
callback
(
"
Feil ved kobling til databasen
"
);
}
else
{
connection
.
query
(
"select
navn, alder, adresse from person
",
"
select
1
"
,
(
err
,
rows
)
=>
{
connection
.
release
();
if
(
err
)
{
console.log(err);
res.json({ error: "error querying" });
callback
(
err
);
}
else
{
console.log("returning rows");
res.json(rows);
callback
(
"
SUCCESS
"
);
}
}
);
}
}); */
expect
(
3
).
toBe
(
3
);
});
});
\ No newline at end of file
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