Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Olive
olive-recipes-api
Commits
3389514d
Commit
3389514d
authored
3 years ago
by
Arthur Sudbrack Ibarra
😁
Browse files
Options
Download
Email Patches
Plain Diff
Finalizado os testes de endpoint para obter uma receita por id
parent
ae06a330
Pipeline
#1126
passed with stage
in 1 minute and 4 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/__tests__/endpoints/recipeEndpoints.ts
+16
-6
src/__tests__/endpoints/recipeEndpoints.ts
with
16 additions
and
6 deletions
+16
-6
src/__tests__/endpoints/recipeEndpoints.ts
View file @
3389514d
import
supertest
from
'
supertest
'
;
import
indexTags
from
'
../../controllers/tagController
'
;
import
db
from
'
../../database/connection
'
;
import
Recipe
from
'
../../models/recipe
'
;
import
app
from
'
../../server
'
;
...
...
@@ -60,8 +59,6 @@ describe('Getting recipes - Endpoint', () => {
});
});
it
(
'
Like number property should be zero or greather
'
,
async
()
=>
{
const
response
=
await
request
.
get
(
'
/recipes
'
);
...
...
@@ -113,7 +110,7 @@ describe('Getting recipes - Endpoint', () => {
expect
(
recipe
).
toHaveProperty
(
'
steps
'
);
});
});
it
(
'
recipe_id should
have to
be the same
of
the passed id
'
,
async
()
=>
{
it
(
'
recipe_id should be the same
as
the passed id
'
,
async
()
=>
{
const
response
=
await
request
.
get
(
'
/recipes/1
'
);
const
recipe
:
Recipe
=
response
.
body
.
data
;
...
...
@@ -123,6 +120,21 @@ describe('Getting recipes - Endpoint', () => {
expect
(
recipe
.
recipe_id
).
toBe
(
1
);
});
it
(
'
recipe should have the property recipe_id
'
,
async
()
=>
{
const
response
=
await
request
.
get
(
'
/recipes/1
'
);
const
recipe
:
Recipe
=
response
.
body
.
data
;
expect
(
response
.
status
).
toBe
(
200
);
expect
(
response
.
body
).
not
.
toBe
(
null
);
expect
(
recipe
).
toHaveProperty
(
'
recipe_id
'
);
});
it
(
'
should not return a recipe with an id that doesnt exists
'
,
async
()
=>
{
const
response
=
await
request
.
get
(
'
/recipes/9999
'
);
expect
(
response
.
status
).
toBe
(
404
);
expect
(
response
.
body
).
toBe
(
null
);
});
});
describe
(
'
Creating recipes - Endpoint
'
,
()
=>
{
...
...
@@ -217,8 +229,6 @@ describe('Creating recipes - Endpoint', () => {
});
});
afterAll
(
async
()
=>
{
await
db
.
migrate
.
rollback
();
await
db
.
destroy
();
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help