Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
EMS
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue 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
Fazalur Rahman
EMS
Commits
74f9504f
Unverified
Commit
74f9504f
authored
3 years ago
by
Fazal
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add files via upload
parent
02416de0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
server/test/app.test.js
+58
-0
58 additions, 0 deletions
server/test/app.test.js
server/test/fixtures.js
+15
-0
15 additions, 0 deletions
server/test/fixtures.js
server/users-db.jpeg
+0
-0
0 additions, 0 deletions
server/users-db.jpeg
with
73 additions
and
0 deletions
server/test/app.test.js
0 → 100644
+
58
−
0
View file @
74f9504f
const
request
=
require
(
'
supertest
'
);
const
knex
=
require
(
'
../db/knex
'
);
const
expect
=
require
(
'
chai
'
).
expect
;
const
app
=
require
(
'
../app
'
);
const
fixtures
=
require
(
'
./fixtures
'
);
describe
(
'
CRUD employee
'
,
()
=>
{
Before
(()
=>
{
// run migation
knex
.
migrate
.
latest
()
.
then
(()
=>
{
//run seeds
return
knex
.
seed
.
run
();
}).
then
(()
=>
done
());
});
it
(
'
List all Records
'
,
(
done
)
=>
{
request
(
app
)
.
get
(
'
api/employee
'
)
.
set
(
'
Accept
'
,
'
application/json
'
)
.
expect
(
'
Content-Type
'
,
/json/
)
.
expect
(
200
)
.
then
((
response
)
=>
{
expect
(
response
.
body
).
to
.
be
.
a
(
'
array
'
);
expect
(
response
.
body
).
to
.
deep
.
equal
(
fixtures
.
employee
);
done
();
});
});
it
(
'
Lists a Record by id
'
,
(
done
)
=>
{
request
(
app
)
.
get
(
'
api/employee/1
'
)
.
set
(
'
Accept
'
,
'
application/json
'
)
.
expect
(
'
Content-Type
'
,
/json/
)
.
expect
(
200
)
.
then
((
response
)
=>
{
expect
(
response
.
body
).
to
.
be
.
a
(
'
object
'
);
expect
(
response
.
body
).
to
.
deep
.
equal
(
fixtures
.
employee
);
done
();
});
it
(
'
creates a record
'
,
(
done
)
=>
{
request
(
app
)
.
post
(
'
/api/employee
'
)
.
send
(
fixtures
.
employee
)
.
set
(
'
accept
'
,
'
application/json
'
)
.
expect
(
'
Content-Type
'
,
'
/json/
'
)
.
expect
(
200
)
.
then
((
response
)
=>
{
expect
(
response
.
body
).
to
.
be
.
a
(
'
object
'
);
fixtures
.
employee
.
id
=
response
.
body
.
id
;
expect
(
response
.
body
).
to
.
deep
.
equal
(
fixtures
.
employee
);
done
();
});
});
});
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
server/test/fixtures.js
0 → 100644
+
15
−
0
View file @
74f9504f
const
employee
=
[
{
id
:
1
,
name
:
'
fazal
'
,
mobile
:
'
9789898908
'
,
email
:
'
fazalurrahman2005@gmail.com
'
,
designation
:
'
intern
'
,
role
:
'
web dev
'
,
type
:
'
admin
'
,
date_of_joining
:
'
10-12-2021
'
,
date_of_birth
:
'
19-03-2005
'
,
address
:
'
No.5 medavakkam main road,xxxx
'
}]
module
.
exports
=
{
employee
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
server/users-db.jpeg
0 → 100644
+
0
−
0
View file @
74f9504f
13 KiB
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
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