Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
update tests MessagerieBoiteReception pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
maelgangloff committed May 24, 2021
1 parent 939af94 commit 02b9034
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/cache@v2
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
key: node-modules-${{ hashFiles('yarn.lock') }}

- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
Expand Down
28 changes: 28 additions & 0 deletions OpenAPI/components/paths/messagerie/boiteReceptionPagination.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
get:
summary: Retourne les fils de discussion.
operationId: messagerieBoiteReceptionPagination
tags:
- Messagerie
security:
- AuthToken: [ ]
- AppVersion: [ ]
parameters:
- in: path
description: Le nombre de fils de discussion les plus récents à tronquer.
name: pagination
required: true
schema:
type: number
responses:
200:
description: Le serveur retourne les fils de discussion.
content:
application/json:
schema:
$ref: '../../responses/messagerie/boiteReception.yaml'
403:
description: Le serveur vous refuse l'accès.
content:
application/json:
schema:
$ref: '../../schemas/errmsg.yaml'
2 changes: 1 addition & 1 deletion OpenAPI/components/paths/messagerie/communication.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ get:
name: communication
required: true
schema:
type: string
type: number
responses:
200:
description: Le serveur retourne le fil de discussion.
Expand Down
2 changes: 1 addition & 1 deletion OpenAPI/components/paths/messagerie/communicationLu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ put:
name: communication
required: true
schema:
type: string
type: number
responses:
200:
description: Le serveur marque la communication lue.
Expand Down
2 changes: 1 addition & 1 deletion OpenAPI/kdecole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ paths:
$ref: './components/paths/messagerie/boiteReception.yaml'

/messagerie/boiteReception/{pagination}/:
$ref: './components/paths/messagerie/boiteReception.yaml'
$ref: './components/paths/messagerie/boiteReceptionPagination.yaml'

/messagerie/communication/{communication}/:
$ref: './components/paths/messagerie/communication.yaml'
Expand Down
12 changes: 12 additions & 0 deletions tests/Messagerie/MessagerieBoiteReception.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,16 @@ describe('Test Messagerie Boite de réception', () => {
"url": "/messagerie/boiteReception/"
})
})
it('should call the right url and return boite de réception when pagination parameter is given', async () => {
expect(await user.getMessagerieBoiteReception(20)).toBeInstanceOf(MessageBoiteReception)
expect(axios.request).toBeCalledWith({
"baseURL": ApiUrl.PROD_MON_BUREAU_NUMERIQUE,
"data": undefined,
"headers": {"X-Kdecole-Auth": authToken, "X-Kdecole-Vers": APP_VERSION},
validateStatus: expect.any(Function),
"method": "get",
"responseType": "json",
"url": "/messagerie/boiteReception/20/"
})
})
})

0 comments on commit 02b9034

Please sign in to comment.