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

@ -97,6 +97,7 @@ describe('<LeftPanelLiveShareWarning />', () => {
});
beforeEach(() => {
// @ts-ignore writing to readonly variable
mocked(OwnBeaconStore.instance).isMonitoringLiveLocation = true;
mocked(OwnBeaconStore.instance).getLiveBeaconIdsWithLocationPublishError.mockReturnValue([]);
mocked(OwnBeaconStore.instance).getLiveBeaconIds.mockReturnValue([beacon2.identifier, beacon1.identifier]);
@ -190,6 +191,7 @@ describe('<LeftPanelLiveShareWarning />', () => {
expect(container.innerHTML).toBeTruthy();
act(() => {
// @ts-ignore writing to readonly variable
mocked(OwnBeaconStore.instance).isMonitoringLiveLocation = false;
OwnBeaconStore.instance.emit(OwnBeaconStoreEvent.MonitoringLivePosition);
});

View file

@ -4,19 +4,19 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
<BeaconMarker
beacon={
Beacon {
"_beaconInfo": Object {
"_beaconInfo": {
"assetType": "m.self",
"description": undefined,
"live": true,
"timeout": 3600000,
"timestamp": 1647270879403,
},
"_events": Object {
"Beacon.Destroy": Array [
"_events": {
"Beacon.Destroy": [
[Function],
[Function],
],
"Beacon.LivenessChange": Array [
"Beacon.LivenessChange": [
[Function],
[Function],
],
@ -26,13 +26,13 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
},
"_eventsCount": 5,
"_isLive": true,
"_latestLocationEvent": Object {
"content": Object {
"m.relates_to": Object {
"_latestLocationEvent": {
"content": {
"m.relates_to": {
"event_id": "$alice-room1-1",
"rel_type": "m.reference",
},
"org.matrix.msc3488.location": Object {
"org.matrix.msc3488.location": {
"description": undefined,
"uri": "geo:51,41",
},
@ -46,11 +46,11 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
"clearLatestLocation": [Function],
"livenessWatchTimeout": undefined,
"roomId": "!room:server",
"rootEvent": Object {
"content": Object {
"rootEvent": {
"content": {
"description": undefined,
"live": true,
"org.matrix.msc3488.asset": Object {
"org.matrix.msc3488.asset": {
"type": "m.self",
},
"org.matrix.msc3488.ts": 1647270879403,
@ -68,7 +68,7 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
}
map={
MockMap {
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_maxListeners": undefined,
"addControl": [MockFunction],
@ -87,7 +87,7 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
id="!room:server_@alice:server"
map={
MockMap {
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_maxListeners": undefined,
"addControl": [MockFunction],
@ -102,12 +102,12 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
}
roomMember={
RoomMember {
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_isOutOfBand": false,
"_maxListeners": undefined,
"disambiguate": false,
"events": Object {},
"events": {},
"membership": undefined,
"modified": 1647270879403,
"name": "@alice:server",
@ -129,12 +129,12 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
id="!room:server_@alice:server"
roomMember={
RoomMember {
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_isOutOfBand": false,
"_maxListeners": undefined,
"disambiguate": false,
"events": Object {},
"events": {},
"membership": undefined,
"modified": 1647270879403,
"name": "@alice:server",
@ -164,12 +164,12 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
hideTitle={false}
member={
RoomMember {
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_isOutOfBand": false,
"_maxListeners": undefined,
"disambiguate": false,
"events": Object {},
"events": {},
"membership": undefined,
"modified": 1647270879403,
"name": "@alice:server",
@ -205,7 +205,7 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
aria-hidden="true"
className="mx_BaseAvatar_initial"
style={
Object {
{
"fontSize": "23.400000000000002px",
"lineHeight": "36px",
"width": "36px",
@ -221,7 +221,7 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
onError={[Function]}
src="data:image/png;base64,00"
style={
Object {
{
"height": "36px",
"width": "36px",
}

View file

@ -6,14 +6,14 @@ exports[`<BeaconStatus /> active state renders without children 1`] = `
<BeaconStatus
beacon={
Beacon {
"_beaconInfo": Object {
"_beaconInfo": {
"assetType": "m.self",
"description": undefined,
"live": false,
"timeout": 3600000,
"timestamp": 123456789,
},
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_isLive": false,
"_latestLocationEvent": undefined,
@ -21,11 +21,11 @@ exports[`<BeaconStatus /> active state renders without children 1`] = `
"clearLatestLocation": [Function],
"livenessWatchTimeout": undefined,
"roomId": "!room:server",
"rootEvent": Object {
"content": Object {
"rootEvent": {
"content": {
"description": undefined,
"live": false,
"org.matrix.msc3488.asset": Object {
"org.matrix.msc3488.asset": {
"type": "m.self",
},
"org.matrix.msc3488.ts": 123456789,
@ -68,14 +68,14 @@ exports[`<BeaconStatus /> active state renders without children 1`] = `
<BeaconExpiryTime
beacon={
Beacon {
"_beaconInfo": Object {
"_beaconInfo": {
"assetType": "m.self",
"description": undefined,
"live": false,
"timeout": 3600000,
"timestamp": 123456789,
},
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_isLive": false,
"_latestLocationEvent": undefined,
@ -83,11 +83,11 @@ exports[`<BeaconStatus /> active state renders without children 1`] = `
"clearLatestLocation": [Function],
"livenessWatchTimeout": undefined,
"roomId": "!room:server",
"rootEvent": Object {
"content": Object {
"rootEvent": {
"content": {
"description": undefined,
"live": false,
"org.matrix.msc3488.asset": Object {
"org.matrix.msc3488.asset": {
"type": "m.self",
},
"org.matrix.msc3488.ts": 123456789,

View file

@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<BeaconViewDialog /> renders a fallback when there are no locations 1`] = `
Array [
[
<MapFallback
className="mx_BeaconViewDialog_map"
data-test-id="beacon-view-dialog-map-fallback"

View file

@ -1,10 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is available renders correctly with one live beacon in room 1`] = `"<div class=\\"mx_RoomLiveShareWarning\\"><div class=\\"mx_StyledLiveBeaconIcon mx_RoomLiveShareWarning_icon\\"></div><span class=\\"mx_RoomLiveShareWarning_label\\">You are sharing your live location</span><span data-test-id=\\"room-live-share-expiry\\" class=\\"mx_LiveTimeRemaining\\">1h left</span><button data-test-id=\\"room-live-share-primary-button\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_RoomLiveShareWarning_stopButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_danger\\">Stop</button></div>"`;
exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is available renders correctly with one live beacon in room 1`] = `"<div class="mx_RoomLiveShareWarning"><div class="mx_StyledLiveBeaconIcon mx_RoomLiveShareWarning_icon"></div><span class="mx_RoomLiveShareWarning_label">You are sharing your live location</span><span data-test-id="room-live-share-expiry" class="mx_LiveTimeRemaining">1h left</span><button data-test-id="room-live-share-primary-button" role="button" tabindex="0" class="mx_AccessibleButton mx_RoomLiveShareWarning_stopButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_danger">Stop</button></div>"`;
exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is available renders correctly with two live beacons in room 1`] = `"<div class=\\"mx_RoomLiveShareWarning\\"><div class=\\"mx_StyledLiveBeaconIcon mx_RoomLiveShareWarning_icon\\"></div><span class=\\"mx_RoomLiveShareWarning_label\\">You are sharing your live location</span><span data-test-id=\\"room-live-share-expiry\\" class=\\"mx_LiveTimeRemaining\\">12h left</span><button data-test-id=\\"room-live-share-primary-button\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_RoomLiveShareWarning_stopButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_danger\\">Stop</button></div>"`;
exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is available renders correctly with two live beacons in room 1`] = `"<div class="mx_RoomLiveShareWarning"><div class="mx_StyledLiveBeaconIcon mx_RoomLiveShareWarning_icon"></div><span class="mx_RoomLiveShareWarning_label">You are sharing your live location</span><span data-test-id="room-live-share-expiry" class="mx_LiveTimeRemaining">12h left</span><button data-test-id="room-live-share-primary-button" role="button" tabindex="0" class="mx_AccessibleButton mx_RoomLiveShareWarning_stopButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_danger">Stop</button></div>"`;
exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is available stopping beacons displays error when stop sharing fails 1`] = `"<div class=\\"mx_RoomLiveShareWarning\\"><div class=\\"mx_StyledLiveBeaconIcon mx_RoomLiveShareWarning_icon mx_StyledLiveBeaconIcon_error\\"></div><span class=\\"mx_RoomLiveShareWarning_label\\">An error occurred while stopping your live location, please try again</span><button data-test-id=\\"room-live-share-primary-button\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_RoomLiveShareWarning_stopButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_danger\\">Retry</button></div>"`;
exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is available stopping beacons displays error when stop sharing fails 1`] = `"<div class="mx_RoomLiveShareWarning"><div class="mx_StyledLiveBeaconIcon mx_RoomLiveShareWarning_icon mx_StyledLiveBeaconIcon_error"></div><span class="mx_RoomLiveShareWarning_label">An error occurred while stopping your live location, please try again</span><button data-test-id="room-live-share-primary-button" role="button" tabindex="0" class="mx_AccessibleButton mx_RoomLiveShareWarning_stopButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_danger">Retry</button></div>"`;
exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is available with location publish errors displays location publish error when mounted with location publish errors 1`] = `
<RoomLiveShareWarning
@ -12,7 +12,7 @@ exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is
>
<RoomLiveShareWarningInner
liveBeaconIds={
Array [
[
"$room2:server.org_@alice:server.org",
]
}