Optimise Jest run in CI (#9542)

This commit is contained in:
Michael Telatynski 2022-11-04 10:48:08 +00:00 committed by GitHub
parent 28ecdc0cb4
commit 04bc8fb71c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
55 changed files with 1388 additions and 1305 deletions

View file

@ -479,7 +479,5 @@ describe('<LocationShareMenu />', () => {
function enableSettings(settings: string[]) {
mocked(SettingsStore).getValue.mockReturnValue(false);
mocked(SettingsStore).getValue.mockImplementation(
(settingName: string) => settings.includes(settingName),
);
mocked(SettingsStore).getValue.mockImplementation((settingName: string): any => settings.includes(settingName));
}

View file

@ -18,20 +18,20 @@ exports[`<LocationViewDialog /> renders map correctly 1`] = `
id="mx_LocationViewDialog_$2-marker"
map={
MockMap {
"_events": Object {
"_events": {
"error": [Function],
},
"_eventsCount": 1,
"_maxListeners": undefined,
"addControl": [MockFunction] {
"calls": Array [
Array [
"calls": [
[
mockConstructor {},
"top-right",
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},
@ -40,16 +40,16 @@ exports[`<LocationViewDialog /> renders map correctly 1`] = `
"fitBounds": [MockFunction],
"removeControl": [MockFunction],
"setCenter": [MockFunction] {
"calls": Array [
Array [
Object {
"calls": [
[
{
"lat": 51.5076,
"lon": -0.1276,
},
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},
@ -86,20 +86,20 @@ exports[`<LocationViewDialog /> renders map correctly 1`] = `
<ZoomButtons
map={
MockMap {
"_events": Object {
"_events": {
"error": [Function],
},
"_eventsCount": 1,
"_maxListeners": undefined,
"addControl": [MockFunction] {
"calls": Array [
Array [
"calls": [
[
mockConstructor {},
"top-right",
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},
@ -108,16 +108,16 @@ exports[`<LocationViewDialog /> renders map correctly 1`] = `
"fitBounds": [MockFunction],
"removeControl": [MockFunction],
"setCenter": [MockFunction] {
"calls": Array [
Array [
Object {
"calls": [
[
{
"lat": 51.5076,
"lon": -0.1276,
},
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},

View file

@ -5,7 +5,7 @@ exports[`<SmartMarker /> creates a marker on mount 1`] = `
geoUri="geo:43.2,54.6"
map={
MockMap {
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_maxListeners": undefined,
"addControl": [MockFunction],
@ -44,7 +44,7 @@ exports[`<SmartMarker /> removes marker on unmount 1`] = `
geoUri="geo:43.2,54.6"
map={
MockMap {
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_maxListeners": undefined,
"addControl": [MockFunction],

View file

@ -4,7 +4,7 @@ exports[`<ZoomButtons /> renders buttons 1`] = `
<ZoomButtons
map={
MockMap {
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_maxListeners": undefined,
"addControl": [MockFunction],

View file

@ -15,7 +15,7 @@ limitations under the License.
*/
import { mocked } from "jest-mock";
import { ISendEventResponse, MatrixClient } from "matrix-js-sdk/src/matrix";
import { MatrixClient } from "matrix-js-sdk/src/matrix";
import { makeLocationContent } from "matrix-js-sdk/src/content-helpers";
import { LegacyLocationEventContent, MLocationEventContent } from "matrix-js-sdk/src/@types/location";
@ -47,9 +47,9 @@ describe("shareLocation", () => {
} as unknown as MatrixClient;
mocked(makeLocationContent).mockReturnValue(content);
mocked(doMaybeLocalRoomAction).mockImplementation((
mocked(doMaybeLocalRoomAction).mockImplementation(<T>(
roomId: string,
fn: (actualRoomId: string) => Promise<ISendEventResponse>,
fn: (actualRoomId: string) => Promise<T>,
client?: MatrixClient,
) => {
return fn(roomId);