Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
promotions-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ascend
promotions-service
Commits
d7e70e39
Commit
d7e70e39
authored
May 06, 2021
by
John Lam
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://gitlab.mynisum.com/ascend/promotions-backend
into dev
parents
cd29ffe2
0f54d0d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
2 deletions
+40
-2
PromotionsControllerTest.java
...scend/promotions/controller/PromotionsControllerTest.java
+40
-2
No files found.
src/test/java/com/nisum/ascend/promotions/controller/PromotionsControllerTest.java
View file @
d7e70e39
...
...
@@ -33,11 +33,11 @@ class PromotionsControllerTest {
}
@Test
void
getAllPromotions
()
{
webTestClient
.
get
().
uri
(
"
http://localhost:8081
/api/promos"
).
exchange
()
webTestClient
.
get
().
uri
(
"/api/promos"
).
exchange
()
.
expectStatus
().
isOk
()
.
expectHeader
().
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
expectBodyList
(
PromotionDto
.
class
)
.
hasSize
(
2
)
//
.hasSize(2)
.
consumeWith
(
promo
->{
List
<
PromotionDto
>
promos
=
promo
.
getResponseBody
();
assert
promos
!=
null
;
...
...
@@ -48,4 +48,42 @@ class PromotionsControllerTest {
});
});
}
@Test
void
getPromotionsByProductSku
(){
String
skuWithOnePromo
=
"AFP-1"
;
String
skuWithMultiplePromos
=
"AFP-2"
;
webTestClient
.
get
()
.
uri
(
uriBuilder
->
uriBuilder
.
path
(
"/api/promos"
)
.
queryParam
(
"sku"
,
skuWithOnePromo
)
.
build
())
.
exchange
()
.
expectStatus
().
isOk
()
.
expectHeader
().
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
expectBodyList
(
PromotionDto
.
class
)
.
hasSize
(
1
)
.
consumeWith
(
promo
->{
List
<
PromotionDto
>
promos
=
promo
.
getResponseBody
();
assert
promos
!=
null
;
promos
.
forEach
(
p
->
assertEquals
(
skuWithOnePromo
,
p
.
getProductSku
()));
});
webTestClient
.
get
()
.
uri
(
uriBuilder
->
uriBuilder
.
path
(
"/api/promos"
)
.
queryParam
(
"sku"
,
skuWithMultiplePromos
)
.
build
())
.
exchange
()
.
expectStatus
().
isOk
()
.
expectHeader
().
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
expectBodyList
(
PromotionDto
.
class
)
.
hasSize
(
2
)
.
consumeWith
(
promo
->{
List
<
PromotionDto
>
promos
=
promo
.
getResponseBody
();
assert
promos
!=
null
;
promos
.
forEach
(
p
->
assertEquals
(
skuWithMultiplePromos
,
p
.
getProductSku
()));
});
}
}
\ No newline at end of file
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