build(dev-deps): update fetch-mock to v11 (#33854)

Signed-off-by: hainenber <dotronghai96@gmail.com>
This commit is contained in:
Đỗ Trọng Hải
2025-06-24 03:45:51 +07:00
committed by GitHub
parent 573dd0edec
commit 1c2e148d03
10 changed files with 45 additions and 143 deletions

View File

@@ -184,7 +184,6 @@
"@testing-library/user-event": "^12.8.3",
"@types/classnames": "^2.2.10",
"@types/dom-to-image": "^2.6.7",
"@types/fetch-mock": "^7.3.2",
"@types/jest": "^29.5.14",
"@types/js-levenshtein": "^1.1.3",
"@types/json-bigint": "^1.0.4",
@@ -245,7 +244,7 @@
"eslint-plugin-storybook": "^0.8.0",
"eslint-plugin-testing-library": "^6.4.0",
"eslint-plugin-theme-colors": "file:eslint-rules/eslint-plugin-theme-colors",
"fetch-mock": "^9.1.0",
"fetch-mock": "^11.1.4",
"fork-ts-checker-webpack-plugin": "^9.0.2",
"history": "^5.3.0",
"html-webpack-plugin": "^5.6.3",
@@ -13573,13 +13572,6 @@
"@types/send": "*"
}
},
"node_modules/@types/fetch-mock": {
"version": "7.3.8",
"resolved": "https://registry.npmjs.org/@types/fetch-mock/-/fetch-mock-7.3.8.tgz",
"integrity": "sha512-ztsIGiyUvD0GaqPc9/hb8k20gnr6lupqA6SFtqt+8v2mtHhNO/Ebb6/b7N6af/7x0A7s1C8nxrEGzajMBqz8qA==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/file-saver": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/@types/file-saver/-/file-saver-2.0.7.tgz",
@@ -24291,32 +24283,20 @@
}
},
"node_modules/fetch-mock": {
"version": "9.11.0",
"resolved": "https://registry.npmjs.org/fetch-mock/-/fetch-mock-9.11.0.tgz",
"integrity": "sha512-PG1XUv+x7iag5p/iNHD4/jdpxL9FtVSqRMUQhPab4hVDt80T1MH5ehzVrL2IdXO9Q2iBggArFvPqjUbHFuI58Q==",
"version": "11.1.5",
"resolved": "https://registry.npmjs.org/fetch-mock/-/fetch-mock-11.1.5.tgz",
"integrity": "sha512-KHmZDnZ1ry0pCTrX4YG5DtThHi0MH+GNI9caESnzX/nMJBrvppUHMvLx47M0WY9oAtKOMiPfZDRpxhlHg89BOA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/core": "^7.0.0",
"@babel/runtime": "^7.0.0",
"core-js": "^3.0.0",
"debug": "^4.1.1",
"glob-to-regexp": "^0.4.0",
"@types/glob-to-regexp": "^0.4.4",
"dequal": "^2.0.3",
"glob-to-regexp": "^0.4.1",
"is-subset": "^0.1.1",
"lodash.isequal": "^4.5.0",
"path-to-regexp": "^2.2.1",
"querystring": "^0.2.0",
"whatwg-url": "^6.5.0"
"regexparam": "^3.0.0"
},
"engines": {
"node": ">=4.0.0"
},
"funding": {
"type": "charity",
"url": "https://www.justgiving.com/refugee-support-europe"
},
"peerDependencies": {
"node-fetch": "*"
"node": ">=8.0.0"
},
"peerDependenciesMeta": {
"node-fetch": {
@@ -24324,13 +24304,6 @@
}
}
},
"node_modules/fetch-mock/node_modules/path-to-regexp": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-2.4.0.tgz",
"integrity": "sha512-G6zHoVqC6GGTQkZwF4lkuEyMbVOjoBKAEybQUypI1WTkqinCOrq2x6U2+phkJ1XsEMTy4LjtwPI7HW+NVrRR2w==",
"dev": true,
"license": "MIT"
},
"node_modules/fetch-retry": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/fetch-retry/-/fetch-retry-6.0.0.tgz",
@@ -32972,13 +32945,6 @@
"integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==",
"license": "MIT"
},
"node_modules/lodash.sortby": {
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz",
"integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==",
"dev": true,
"license": "MIT"
},
"node_modules/lodash.startcase": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.startcase/-/lodash.startcase-4.4.0.tgz",
@@ -42310,17 +42276,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/querystring": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.1.tgz",
"integrity": "sha512-wkvS7mL/JMugcup3/rMitHmd9ecIGd2lhFhK9N3UUQ450h66d1r3Y9nvXzQAW1Lq+wyx61k/1pfKS5KuKiyEbg==",
"deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.4.x"
}
},
"node_modules/querystringify": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
@@ -50010,26 +49965,6 @@
"node": ">=16"
}
},
"node_modules/tr46": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz",
"integrity": "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==",
"dev": true,
"license": "MIT",
"dependencies": {
"punycode": "^2.1.0"
}
},
"node_modules/tr46/node_modules/punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/traverse": {
"version": "0.6.11",
"resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.11.tgz",
@@ -52772,25 +52707,6 @@
"node": ">=18"
}
},
"node_modules/whatwg-url": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz",
"integrity": "sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"lodash.sortby": "^4.7.0",
"tr46": "^1.0.1",
"webidl-conversions": "^4.0.2"
}
},
"node_modules/whatwg-url/node_modules/webidl-conversions": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz",
"integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==",
"dev": true,
"license": "BSD-2-Clause"
},
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
@@ -54107,7 +54023,6 @@
"@types/d3-scale": "^2.1.1",
"@types/d3-time": "^3.0.4",
"@types/d3-time-format": "^4.0.3",
"@types/fetch-mock": "^7.3.8",
"@types/jquery": "^3.5.8",
"@types/lodash": "^4.17.16",
"@types/math-expression-evaluator": "^1.3.3",
@@ -54209,28 +54124,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"packages/superset-ui-core/node_modules/fetch-mock": {
"version": "11.1.5",
"resolved": "https://registry.npmjs.org/fetch-mock/-/fetch-mock-11.1.5.tgz",
"integrity": "sha512-KHmZDnZ1ry0pCTrX4YG5DtThHi0MH+GNI9caESnzX/nMJBrvppUHMvLx47M0WY9oAtKOMiPfZDRpxhlHg89BOA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/glob-to-regexp": "^0.4.4",
"dequal": "^2.0.3",
"glob-to-regexp": "^0.4.1",
"is-subset": "^0.1.1",
"regexparam": "^3.0.0"
},
"engines": {
"node": ">=8.0.0"
},
"peerDependenciesMeta": {
"node-fetch": {
"optional": true
}
}
},
"packages/superset-ui-core/node_modules/math-expression-evaluator": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/math-expression-evaluator/-/math-expression-evaluator-2.0.6.tgz",

View File

@@ -252,7 +252,6 @@
"@testing-library/user-event": "^12.8.3",
"@types/classnames": "^2.2.10",
"@types/dom-to-image": "^2.6.7",
"@types/fetch-mock": "^7.3.2",
"@types/jest": "^29.5.14",
"@types/js-levenshtein": "^1.1.3",
"@types/json-bigint": "^1.0.4",
@@ -313,7 +312,7 @@
"eslint-plugin-storybook": "^0.8.0",
"eslint-plugin-testing-library": "^6.4.0",
"eslint-plugin-theme-colors": "file:eslint-rules/eslint-plugin-theme-colors",
"fetch-mock": "^9.1.0",
"fetch-mock": "^11.1.5",
"fork-ts-checker-webpack-plugin": "^9.0.2",
"history": "^5.3.0",
"html-webpack-plugin": "^5.6.3",

View File

@@ -72,7 +72,6 @@
"@types/d3-time": "^3.0.4",
"@types/d3-time-format": "^4.0.3",
"@types/react-table": "^7.7.20",
"@types/fetch-mock": "^7.3.8",
"@types/jquery": "^3.5.8",
"@types/lodash": "^4.17.16",
"@types/math-expression-evaluator": "^1.3.3",

View File

@@ -1,6 +1,3 @@
/**
* @jest-environment jsdom
*/
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file

View File

@@ -35,9 +35,9 @@ const loadComponent = (mockCurrentTime?: string) => {
const getSelectOptions = () =>
waitFor(() => document.querySelectorAll('.ant-select-item-option-content'));
const openSelectMenu = async () => {
const openSelectMenu = () => {
const searchInput = screen.getByRole('combobox');
await userEvent.click(searchInput);
userEvent.click(searchInput);
};
jest.spyOn(extendedDayjs.tz, 'guess').mockReturnValue('America/New_York');

View File

@@ -110,7 +110,7 @@ describe('SupersetClient', () => {
networkCalls.map((url: string) =>
expect(fetchMock.calls(url)[0][1]?.headers).toStrictEqual({
Accept: 'application/json',
'X-CSRFToken': '',
'X-CSRFToken': '1234',
}),
);

View File

@@ -240,7 +240,7 @@ test('On failed request, restore previous selection', async () => {
// Verify error toast
await waitFor(() => {
expect(dangerToastSpy).toHaveBeenCalledWith(
'Sorry, there was an error saving this dashboard: Unknown Error',
'Sorry, there was an error saving this dashboard: Bad Request',
);
});

View File

@@ -123,7 +123,7 @@ describe('ResultsPaneOnDashboard', () => {
useRedux: true,
});
expect(await findByText('0 rows')).toBeVisible();
expect(await findByText('Bad Request')).toBeVisible();
expect(await findByText('Bad request')).toBeVisible();
});
test('force query, render and search', async () => {

View File

@@ -86,7 +86,7 @@ describe('SamplesPane', () => {
useRedux: true,
});
expect(await findByText('Error: Bad Request')).toBeVisible();
expect(await findByText('Error: Bad request')).toBeVisible();
});
test('force query, render and search', async () => {

View File

@@ -120,9 +120,9 @@ describe('asyncEvent middleware', () => {
});
it('resolves with chart data on event done status', async () => {
await expect(
asyncEvent.waitForAsyncData(asyncPendingEvent),
).resolves.toEqual([chartData]);
const actualResolved =
await asyncEvent.waitForAsyncData(asyncPendingEvent);
expect(actualResolved).toEqual([chartData]);
expect(fetchMock.calls(EVENTS_ENDPOINT)).toHaveLength(1);
expect(fetchMock.calls(CACHED_DATA_ENDPOINT)).toHaveLength(1);
@@ -134,10 +134,15 @@ describe('asyncEvent middleware', () => {
status: 200,
body: { result: [asyncErrorEvent] },
});
const errorResponse = await parseErrorJson(asyncErrorEvent);
await expect(
asyncEvent.waitForAsyncData(asyncPendingEvent),
).rejects.toEqual(errorResponse);
const errorResponse = parseErrorJson(asyncErrorEvent);
let error: any = null;
try {
await asyncEvent.waitForAsyncData(asyncPendingEvent);
} catch (err) {
error = err;
} finally {
expect(error).toEqual(errorResponse);
}
expect(fetchMock.calls(EVENTS_ENDPOINT)).toHaveLength(1);
expect(fetchMock.calls(CACHED_DATA_ENDPOINT)).toHaveLength(0);
@@ -153,10 +158,14 @@ describe('asyncEvent middleware', () => {
status: 400,
});
const errorResponse = [{ error: 'Bad Request' }];
await expect(
asyncEvent.waitForAsyncData(asyncPendingEvent),
).rejects.toEqual(errorResponse);
let error = '';
try {
await asyncEvent.waitForAsyncData(asyncPendingEvent);
} catch (err) {
[{ error }] = err;
} finally {
expect(error).toEqual('Bad request');
}
expect(fetchMock.calls(EVENTS_ENDPOINT)).toHaveLength(1);
expect(fetchMock.calls(CACHED_DATA_ENDPOINT)).toHaveLength(1);
@@ -209,7 +218,7 @@ describe('asyncEvent middleware', () => {
wsServer.send(JSON.stringify(asyncErrorEvent));
const errorResponse = await parseErrorJson(asyncErrorEvent);
const errorResponse = parseErrorJson(asyncErrorEvent);
await expect(promise).rejects.toEqual(errorResponse);
@@ -229,9 +238,14 @@ describe('asyncEvent middleware', () => {
wsServer.send(JSON.stringify(asyncDoneEvent));
const errorResponse = [{ error: 'Bad Request' }];
await expect(promise).rejects.toEqual(errorResponse);
let error = '';
try {
await promise;
} catch (err) {
[{ error }] = err;
} finally {
expect(error).toEqual('Bad request');
}
expect(fetchMock.calls(CACHED_DATA_ENDPOINT)).toHaveLength(1);
expect(fetchMock.calls(EVENTS_ENDPOINT)).toHaveLength(0);