Skip to content

Commit 5a3c0ea

Browse files
Lunotterenovate-botLunotteCap
authored
[Livraison-1.1.0] Cancel request and errors api (#149)
* Test + ajout des locks a commencé Pas encore de gestion des cancels * TU * Update dependencies (non-major) * Annuler la requête en cours et en declencher une nouvelle TODO : Mettre à jour doc / TU * TU Directory service et début test du cancel token * Passage des TU TODO : Ecrire javadoc; REMPLACER le nom de la propriete addToDirectory to lock * Test fonctionnel en cours * Tests fonctionnels ok RAF : Check TU / renommer addToDirectory to lock / javadoc * Renommage addToDirectory to lock * Ménage RAF -> Tests fonctionnels Reactjs * Toutes petite modification. Tests fonctionnels avec reactjs Ok * Mise à disposition du service pour obtenir la liste des requêtes en erreurs * Monter de version de axios * Modificatiion du changelog Modification des readme (Ajout d’une feature de la lib) -> doivent être complétés Javadac * Mise à jour de la documentation * Afficher un message d’erreur si on ne retrouve pas la configuration axios avec le label * Test buil android version in ci * Test avec nouvelle configuration * Test avec nouvelle configuration * Update package.json * Update build.yml * Update Rh2EffectsService.spec.ts * Update CHANGELOG.md * Update .travis.yml * modification de la version de @types/lodash et vérification du build de android Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: Charly <charly.beaugrand@capgemini.com>
1 parent 87a7501 commit 5a3c0ea

31 files changed

+817
-488
lines changed

.github/workflows/build.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: react-native-android-build-apk
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- cancel-request
7+
jobs:
8+
install-and-test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- name: Install npm dependencies
13+
run: |
14+
npm install --legacy-peer-deps && npm test
15+
build-android:
16+
needs: install-and-test
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Install npm dependencies
21+
run: |
22+
npm install --legacy-peer-deps
23+
- name: Change wrapper permissions
24+
run: chmod +x ./android/gradlew
25+
- name: Build Android Release
26+
run: |
27+
cd android && ./gradlew assembleRelease
28+
- name: Upload Artifact
29+
uses: actions/upload-artifact@v3
30+
with:
31+
name: app-release.apk
32+
path: android/app/build/outputs/apk/release/
33+
# build-ios:
34+
# needs: install-and-test
35+
# runs-on: macos-latest
36+
# steps:
37+
# - uses: actions/checkout@v3
38+
# - name: Install npm dependencies
39+
# run: |
40+
# npm install --legacy-peer-deps
41+
# - run: xcode-select -p
42+
# - run: pod install
43+
# working-directory: ios
44+
# name: Install pod dependencies
45+
# - name: Build iOS (debug)
46+
# run: xcodebuild \
47+
# -workspace ios/ReactHttpRequestHandler.xcworkspace \
48+
# -scheme ReactHttpRequestHandler \
49+
# clean archive \
50+
# -sdk iphoneos \
51+
# -configuration Debug \
52+
# -UseModernBuildSystem=NO \
53+
# -archivePath $PWD/ReactHttpRequestHandler \
54+
# CODE_SIGNING_ALLOWED=NO
55+

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ branches:
33
- master
44
language: node_js
55
node_js:
6-
- stable
6+
- 17
77
addons:
88
sonarcloud:
99
organization: lunotte

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,6 @@
100100
"language": "typescript",
101101
"mapTo": "javascript"
102102
}
103-
]
103+
],
104+
"typescript.enablePromptUseWorkspaceTsdk": false
104105
}

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
# Changelog
22

3-
## [Unreleased]
4-
Cancel http request. This functionality is available using the available axios instance as described in the axios instance section of the table of contents.
3+
## [1.1.0] - 2022-04-27
4+
5+
### Added
6+
Get API history in errors
7+
Cancel http request
8+
9+
### Updated
10+
Upgrade Axios
11+
Rename addToDirectory to lock
512

613
## [1.0.3] - 2022-01-15
714

__tests__/services/Rh2AxiosConfigService.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ const GOOGLE = 'GOOGLE';
66
const MICROSOFT = 'MICROSOFT';
77

88
const axiosConfig: AxiosRequestConfig = { url: 'https://www.google.com', method: 'GET' };
9-
const configACharger: Rh2AxiosConfig = { axiosRequestConfig: axiosConfig, label: GOOGLE, addToDirectory: true };
9+
const configACharger: Rh2AxiosConfig = { axiosRequestConfig: axiosConfig, label: GOOGLE, lock: true };
1010

1111
const axiosConfig2: AxiosRequestConfig = { url: 'https://www.microsoft.com', method: 'GET' };
12-
const configACharger2: Rh2AxiosConfig = { axiosRequestConfig: axiosConfig2, label: MICROSOFT, addToDirectory: false};
12+
const configACharger2: Rh2AxiosConfig = { axiosRequestConfig: axiosConfig2, label: MICROSOFT, lock: false};
1313

1414
describe('Remove Configuration', () => {
1515
it('Supprime les éléments configurés', () => {

__tests__/services/Rh2AxiosInstanceService.spec.ts

Lines changed: 5 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Created Date: Su Aug yyyy *
55
* Author: <<author> *
66
* ----- *
7-
* Last Modified: Sun Aug 08 2021 *
7+
* Last Modified: 2022 02 12 - 04:37 pm *
88
* Modified By: Charly Beaugrand *
99
* ----- *
1010
* Copyright (c) 2021 Lunotte *
@@ -159,66 +159,8 @@ describe('Init Axios instance', () => {
159159
ejectInterceptor(resultat);
160160
});
161161

162-
// it('List Axios request with key and request', () => {
163-
164-
// const key = 'TEST_VALUE';
165-
// const axiosRequestConfig: AxiosRequestConfig = {
166-
// baseURL: 'http://test.fr'
167-
// };
168-
// const axiosRequestConfigExtended: AxiosRequestConfigExtended = {
169-
// key,
170-
// axiosConfig: axiosRequestConfig,
171-
// defaultInterceptor: false
172-
// };
173-
174-
// initAxiosInstance([
175-
// axiosRequestConfigExtended
176-
// ]);
177-
// expect(Object.keys(rh2ConfigService.getAxiosInstances())).toEqual([
178-
// key
179-
// ]);
180-
181-
// console.log(rh2ConfigService.getAxiosInstances());
182-
// });
183-
184-
// it('List Axios request with key and request - 2 elements', () => {
185-
186-
// const key = 'TEST_VALUE';
187-
// const axiosRequestConfig: AxiosRequestConfig = {
188-
// baseURL: 'http://test.fr'
189-
// };
190-
// const axiosRequestConfigExtended: AxiosRequestConfigExtended = {
191-
// key,
192-
// axiosConfig: axiosRequestConfig
193-
// };
194-
195-
// const key2 = 'TEST_VALUE_2';
196-
// const axiosRequestConfig2: AxiosRequestConfig = {
197-
// baseURL: 'http://test2.fr'
198-
// };
199-
// const axiosRequestConfigExtended2: AxiosRequestConfigExtended = {
200-
// key: key2,
201-
// axiosConfig: axiosRequestConfig2
202-
// };
203-
204-
// initAxiosInstance([
205-
// axiosRequestConfigExtended,
206-
// axiosRequestConfigExtended2
207-
// ]);
208-
// expect(Object.keys(rh2ConfigService.getAxiosInstances())).toEqual([
209-
// key,
210-
// key2
211-
// ]);
212-
// const axiosInstance1 = Object.values(rh2ConfigService.getAxiosInstances())[0];
213-
// const axiosInstance2 = Object.values(rh2ConfigService.getAxiosInstances())[1];
214-
// expect(axiosInstance1.axiosInstance.defaults.baseURL).toEqual(axiosRequestConfig.baseURL);
215-
// expect(axiosInstance2.axiosInstance.defaults.baseURL).toEqual(axiosRequestConfig2.baseURL);
216-
217-
// console.log(rh2ConfigService.getAxiosInstances());
218-
// });
219162
});
220163

221-
222164
describe('Generate a header to interceptor', () => {
223165
const HEARDER_PAR_DEFAUT = {
224166
"Content-Type": "application/json"
@@ -254,7 +196,7 @@ describe('Generate a header to interceptor', () => {
254196
const test: any = 'sdfsdf';
255197

256198
const resultat = await generateHeaders(axiosConfig, [
257-
test as KeyValue
199+
test as KeyValue<string>
258200
]);
259201

260202
expect(resultat.headers[0]).toBeFalsy();
@@ -267,7 +209,7 @@ describe('Generate a header to interceptor', () => {
267209
};
268210
expect(axiosConfig.headers).toBeFalsy();
269211

270-
const test: KeyValue = {
212+
const test: KeyValue<string> = {
271213
key: 'Content-Type',
272214
value: 'application/json'
273215
};
@@ -294,7 +236,7 @@ describe('Generate a header to interceptor', () => {
294236

295237
it('Header param 1', async () => {
296238

297-
const unHeader: KeyValue[] = [
239+
const unHeader: KeyValue<string>[] = [
298240
{
299241
key: 'key-test',
300242
value: 'Test a value'
@@ -312,7 +254,7 @@ describe('Generate a header to interceptor', () => {
312254

313255
it('Header param 2', async () => {
314256

315-
const unHeader: KeyValue[] = [
257+
const unHeader: KeyValue<string>[] = [
316258
{
317259
key: 'key-test',
318260
value: 'Test a value'

0 commit comments

Comments
 (0)