Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Loopback-API-Example
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
Harbor 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
Henrique Varella Ehrenfried
Loopback-API-Example
Commits
0407732c
Commit
0407732c
authored
7 years ago
by
Henrique Varella Ehrenfried
Browse files
Options
Downloads
Patches
Plain Diff
Add tests to geolocation and category
parent
bf8b126d
No related branches found
No related tags found
1 merge request
!1
Acl testing
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/category.js
+2
-2
2 additions, 2 deletions
test/category.js
test/geolocation.js
+36
-5
36 additions, 5 deletions
test/geolocation.js
with
38 additions
and
7 deletions
test/category.js
+
2
−
2
View file @
0407732c
This diff is collapsed.
Click to expand it.
test/geolocation.js
+
36
−
5
View file @
0407732c
...
...
@@ -3,7 +3,12 @@ var env = require('../enviroment');
const
URL
=
env
.
URL
;
describe
(
'
Geolocation
'
,
function
()
{
it
(
'
should create a geolocation as an Android user
'
,
function
()
{
it
(
'
should create a geolocation as an android user
'
,
function
()
{
let
credential
=
{
'
email
'
:
'
user@user.com
'
,
'
password
'
:
'
user
'
,
};
return
chakram
.
post
(
`
${
URL
}
end_users/login`
,
credential
).
then
(
function
(
loginResponse
)
{
let
testObject
=
{
'
category_id
'
:
1
,
'
geolocation_name
'
:
env
.
randomWord
(
10
),
...
...
@@ -11,8 +16,24 @@ describe('Geolocation', function() {
'
longitude
'
:
112.2124214
,
'
when_sent
'
:
new
Date
(
Date
.
now
()),
'
android_id
'
:
env
.
randomId
(
20
),
'
user_id
'
:
loginResponse
.
body
.
result
.
userId
,
'
description_location
'
:
env
.
randomWord
(
6
,
false
,
true
)
+
'
'
+
env
.
randomWord
(
6
),
}
};
return
chakram
.
post
(
`
${
URL
}
geolocations`
,
testObject
).
then
(
function
(
myResponse
)
{
expect
(
myResponse
).
to
.
have
.
status
(
200
);
expect
(
myResponse
.
body
.
result
).
to
.
be
.
a
(
'
object
'
);
});
});
});
it
(
'
should create a geolocation as a logged user
'
,
function
()
{
let
testObject
=
{
'
category_id
'
:
1
,
'
geolocation_name
'
:
env
.
randomWord
(
10
),
'
latitude
'
:
116.2123
,
'
longitude
'
:
50.2124214
,
'
when_sent
'
:
new
Date
(
Date
.
now
()),
'
description_location
'
:
env
.
randomWord
(
6
,
false
,
true
)
+
'
'
+
env
.
randomWord
(
6
),
};
return
chakram
.
post
(
`
${
URL
}
geolocations`
,
testObject
).
then
(
function
(
myResponse
)
{
expect
(
myResponse
).
to
.
have
.
status
(
200
);
expect
(
myResponse
.
body
.
result
).
to
.
be
.
a
(
'
object
'
);
...
...
@@ -33,4 +54,14 @@ describe('Geolocation', function() {
});
});
});
it
(
'
should try to remove one geolocation
'
,
function
()
{
return
chakram
.
get
(
`
${
URL
}
geolocations`
).
then
(
function
(
myResponse
)
{
let
id
=
myResponse
.
body
.
result
[
0
].
id
;
return
chakram
.
delete
(
`
${
URL
}
geolocations/
${
id
}
`
).
then
(
function
(
myResponse2
)
{
expect
(
myResponse2
).
to
.
have
.
status
(
401
);
expect
(
myResponse2
.
body
.
error
.
code
).
to
.
contain
(
'
AUTHORIZATION_REQUIRED
'
);
});
});
});
});
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