Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SMPPIR-CheckIn_API
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
SMPPIR
SMPPIR-CheckIn_API
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
No related merge requests found
Changes
2
Hide 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
...
@@ -18,7 +18,7 @@ describe('Categories', function() {
...
@@ -18,7 +18,7 @@ describe('Categories', function() {
});
});
});
});
});
});
it
(
'
should try to create a new category
'
,
function
(){
it
(
'
should try to create a new category
'
,
function
()
{
let
testObject
=
{
let
testObject
=
{
'
category_name
'
:
'
Terreiro
'
,
'
category_name
'
:
'
Terreiro
'
,
'
category_description
'
:
'
Lugar que mantém as tradições dos afrodescendentes
'
,
'
category_description
'
:
'
Lugar que mantém as tradições dos afrodescendentes
'
,
...
@@ -45,7 +45,7 @@ describe('Categories', function() {
...
@@ -45,7 +45,7 @@ describe('Categories', function() {
});
});
});
});
});
});
it
(
'
should create a new category as admin
'
,
function
(){
it
(
'
should create a new category as admin
'
,
function
()
{
let
testObject
=
{
let
testObject
=
{
'
email
'
:
'
abc@admin.com
'
,
'
email
'
:
'
abc@admin.com
'
,
'
password
'
:
'
admin
'
,
'
password
'
:
'
admin
'
,
...
...
This diff is collapsed.
Click to expand it.
test/geolocation.js
+
36
−
5
View file @
0407732c
...
@@ -3,16 +3,37 @@ var env = require('../enviroment');
...
@@ -3,16 +3,37 @@ var env = require('../enviroment');
const
URL
=
env
.
URL
;
const
URL
=
env
.
URL
;
describe
(
'
Geolocation
'
,
function
()
{
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
),
'
latitude
'
:
10.2123
,
'
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
=
{
let
testObject
=
{
'
category_id
'
:
1
,
'
category_id
'
:
1
,
'
geolocation_name
'
:
env
.
randomWord
(
10
),
'
geolocation_name
'
:
env
.
randomWord
(
10
),
'
latitude
'
:
1
0
.2123
,
'
latitude
'
:
1
16
.2123
,
'
longitude
'
:
112
.2124214
,
'
longitude
'
:
50
.2124214
,
'
when_sent
'
:
new
Date
(
Date
.
now
()),
'
when_sent
'
:
new
Date
(
Date
.
now
()),
'
android_id
'
:
env
.
randomId
(
20
),
'
description_location
'
:
env
.
randomWord
(
6
,
false
,
true
)
+
'
'
+
env
.
randomWord
(
6
),
'
description_location
'
:
env
.
randomWord
(
6
,
false
,
true
)
+
'
'
+
env
.
randomWord
(
6
),
}
}
;
return
chakram
.
post
(
`
${
URL
}
geolocations`
,
testObject
).
then
(
function
(
myResponse
)
{
return
chakram
.
post
(
`
${
URL
}
geolocations`
,
testObject
).
then
(
function
(
myResponse
)
{
expect
(
myResponse
).
to
.
have
.
status
(
200
);
expect
(
myResponse
).
to
.
have
.
status
(
200
);
expect
(
myResponse
.
body
.
result
).
to
.
be
.
a
(
'
object
'
);
expect
(
myResponse
.
body
.
result
).
to
.
be
.
a
(
'
object
'
);
...
@@ -33,4 +54,14 @@ describe('Geolocation', function() {
...
@@ -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