Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 05e179f

Browse files
author
Kerry
authored
make beacon events more specific (#9186)
1 parent 0dffc58 commit 05e179f

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

test/components/views/beacon/BeaconStatus-test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ describe('<BeaconStatus />', () => {
5151
it('renders without children', () => {
5252
// mock for stable snapshot
5353
jest.spyOn(Date, 'now').mockReturnValue(123456789);
54-
const beacon = new Beacon(makeBeaconInfoEvent('@user:server', '!room:server', {}, '$1'));
54+
const beacon = new Beacon(makeBeaconInfoEvent('@user:server', '!room:server', { isLive: false }, '$1'));
5555
const component = getComponent({ beacon, displayStatus: BeaconDisplayStatus.Active });
5656
expect(component).toMatchSnapshot();
5757
});
5858

5959
it('renders with children', () => {
60-
const beacon = new Beacon(makeBeaconInfoEvent('@user:server', '!room:sever'));
60+
const beacon = new Beacon(makeBeaconInfoEvent('@user:server', '!room:sever', { isLive: false }));
6161
const component = getComponent({
6262
beacon,
6363
children: <span data-test-id='test'>test</span>,
@@ -69,15 +69,15 @@ describe('<BeaconStatus />', () => {
6969
it('renders static remaining time when displayLiveTimeRemaining is falsy', () => {
7070
// mock for stable snapshot
7171
jest.spyOn(Date, 'now').mockReturnValue(123456789);
72-
const beacon = new Beacon(makeBeaconInfoEvent('@user:server', '!room:server', {}, '$1'));
72+
const beacon = new Beacon(makeBeaconInfoEvent('@user:server', '!room:server', { isLive: false }, '$1'));
7373
const component = getComponent({ beacon, displayStatus: BeaconDisplayStatus.Active });
7474
expect(component.text().includes('Live until 11:17')).toBeTruthy();
7575
});
7676

7777
it('renders live time remaining when displayLiveTimeRemaining is truthy', () => {
7878
// mock for stable snapshot
7979
jest.spyOn(Date, 'now').mockReturnValue(123456789);
80-
const beacon = new Beacon(makeBeaconInfoEvent('@user:server', '!room:server', {}, '$1'));
80+
const beacon = new Beacon(makeBeaconInfoEvent('@user:server', '!room:server', { isLive: false }, '$1'));
8181
const component = getComponent({
8282
beacon, displayStatus: BeaconDisplayStatus.Active,
8383
displayLiveTimeRemaining: true,

test/components/views/beacon/__snapshots__/BeaconStatus-test.tsx.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ exports[`<BeaconStatus /> active state renders without children 1`] = `
99
"_beaconInfo": Object {
1010
"assetType": "m.self",
1111
"description": undefined,
12-
"live": undefined,
12+
"live": false,
1313
"timeout": 3600000,
1414
"timestamp": 123456789,
1515
},
1616
"_events": Object {},
1717
"_eventsCount": 0,
18-
"_isLive": undefined,
18+
"_isLive": false,
1919
"_latestLocationEvent": undefined,
2020
"_maxListeners": undefined,
2121
"clearLatestLocation": [Function],
@@ -24,7 +24,7 @@ exports[`<BeaconStatus /> active state renders without children 1`] = `
2424
"rootEvent": Object {
2525
"content": Object {
2626
"description": undefined,
27-
"live": undefined,
27+
"live": false,
2828
"org.matrix.msc3488.asset": Object {
2929
"type": "m.self",
3030
},
@@ -71,13 +71,13 @@ exports[`<BeaconStatus /> active state renders without children 1`] = `
7171
"_beaconInfo": Object {
7272
"assetType": "m.self",
7373
"description": undefined,
74-
"live": undefined,
74+
"live": false,
7575
"timeout": 3600000,
7676
"timestamp": 123456789,
7777
},
7878
"_events": Object {},
7979
"_eventsCount": 0,
80-
"_isLive": undefined,
80+
"_isLive": false,
8181
"_latestLocationEvent": undefined,
8282
"_maxListeners": undefined,
8383
"clearLatestLocation": [Function],
@@ -86,7 +86,7 @@ exports[`<BeaconStatus /> active state renders without children 1`] = `
8686
"rootEvent": Object {
8787
"content": Object {
8888
"description": undefined,
89-
"live": undefined,
89+
"live": false,
9090
"org.matrix.msc3488.asset": Object {
9191
"type": "m.self",
9292
},

0 commit comments

Comments
 (0)