From 1466c5c8e11b340ce053a189f9ce0778be4e3ee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dafydd=20Ll=C5=B7r=20Pearson?= Date: Thu, 2 Nov 2023 15:01:22 +0000 Subject: [PATCH] chore: Bump Axios --- editor.planx.uk/package.json | 2 +- editor.planx.uk/pnpm-lock.yaml | 10 +++++----- .../@planx/components/DrawBoundary/Public/index.tsx | 6 +++--- .../src/@planx/components/Send/Public.test.tsx | 7 +++++-- editor.planx.uk/src/api/upload.ts | 2 +- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/editor.planx.uk/package.json b/editor.planx.uk/package.json index 847ac2b757..9d53596ed0 100644 --- a/editor.planx.uk/package.json +++ b/editor.planx.uk/package.json @@ -39,7 +39,7 @@ "@turf/buffer": "^6.5.0", "@turf/helpers": "^6.5.0", "array-move": "^4.0.0", - "axios": "0.27.2", + "axios": "^1.6.0", "bowser": "^2.11.0", "camelcase-keys": "^9.0.0", "classnames": "^2.3.2", diff --git a/editor.planx.uk/pnpm-lock.yaml b/editor.planx.uk/pnpm-lock.yaml index 81b983122f..43454db214 100644 --- a/editor.planx.uk/pnpm-lock.yaml +++ b/editor.planx.uk/pnpm-lock.yaml @@ -121,8 +121,8 @@ dependencies: specifier: ^4.0.0 version: 4.0.0 axios: - specifier: 0.27.2 - version: 0.27.2 + specifier: ^1.6.0 + version: 1.6.0 bowser: specifier: ^2.11.0 version: 2.11.0 @@ -9183,11 +9183,12 @@ packages: resolution: {integrity: sha512-zIURGIS1E1Q4pcrMjp+nnEh+16G56eG/MUllJH8yEvw7asDo7Ac9uhC9KIH5jzpITueEZolfYglnCGIuSBz39g==} engines: {node: '>=4'} - /axios@0.27.2: - resolution: {integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==} + /axios@1.6.0: + resolution: {integrity: sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==} dependencies: follow-redirects: 1.15.2 form-data: 4.0.0 + proxy-from-env: 1.1.0 transitivePeerDependencies: - debug dev: false @@ -17415,7 +17416,6 @@ packages: /proxy-from-env@1.1.0: resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} - dev: true /pseudomap@1.0.2: resolution: {integrity: sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==} diff --git a/editor.planx.uk/src/@planx/components/DrawBoundary/Public/index.tsx b/editor.planx.uk/src/@planx/components/DrawBoundary/Public/index.tsx index 8b73a98ced..78fa2d29ae 100644 --- a/editor.planx.uk/src/@planx/components/DrawBoundary/Public/index.tsx +++ b/editor.planx.uk/src/@planx/components/DrawBoundary/Public/index.tsx @@ -107,9 +107,9 @@ export default function Component(props: Props) {

An interactive map centred on your address, with a red pointer - to draw your property boundary. Click to place points and connect the - lines to make your site. Once you've closed the site shape, - click and drag the lines to modify it. + to draw your property boundary. Click to place points and + connect the lines to make your site. Once you've closed the site + shape, click and drag the lines to modify it.

{!props.hideFileUpload && (

diff --git a/editor.planx.uk/src/@planx/components/Send/Public.test.tsx b/editor.planx.uk/src/@planx/components/Send/Public.test.tsx index 70013e1f92..0dee982b21 100644 --- a/editor.planx.uk/src/@planx/components/Send/Public.test.tsx +++ b/editor.planx.uk/src/@planx/components/Send/Public.test.tsx @@ -1,4 +1,4 @@ -import * as axios from "axios"; +import Axios from "axios"; import React from "react"; import { axe, setup } from "testUtils"; @@ -6,7 +6,10 @@ import hasuraEventsResponseMock from "./mocks/hasuraEventsResponseMock"; import { Destination } from "./model"; import SendComponent from "./Public"; -jest.spyOn(axios, "default").mockImplementation((url: any) => { +jest.mock("axios"); +const mockAxios = Axios as jest.Mocked; + +mockAxios.post.mockImplementation((url: any) => { return { value: url()?.startsWith( `${process.env.REACT_APP_API_URL}/create-send-events/`, diff --git a/editor.planx.uk/src/api/upload.ts b/editor.planx.uk/src/api/upload.ts index 333f7ba8d9..1f3834b1da 100644 --- a/editor.planx.uk/src/api/upload.ts +++ b/editor.planx.uk/src/api/upload.ts @@ -47,7 +47,7 @@ function handleUpload( "Content-Type": "multipart/form-data", }, onUploadProgress: ({ loaded, total }) => { - if (onProgress) { + if (onProgress && total) { onProgress(loaded / total); } },