Apply prettier formatting
This commit is contained in:
parent
1cac306093
commit
526645c791
1576 changed files with 65385 additions and 62478 deletions
|
@ -91,7 +91,7 @@ describe("RelationsHelper", () => {
|
|||
// TODO Michael W: create test utils, remove casts
|
||||
relations = {
|
||||
getRelations: jest.fn(),
|
||||
on: jest.fn().mockImplementation((type, l) => relationsOnAdd = l),
|
||||
on: jest.fn().mockImplementation((type, l) => (relationsOnAdd = l)),
|
||||
off: jest.fn(),
|
||||
} as unknown as Relations;
|
||||
timelineSet = {
|
||||
|
|
|
@ -14,11 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
EventType,
|
||||
MatrixEvent,
|
||||
MsgType,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
import { EventType, MatrixEvent, MsgType } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { getForwardableEvent } from "../../../src/events";
|
||||
import {
|
||||
|
@ -29,53 +25,53 @@ import {
|
|||
makeRoomWithBeacons,
|
||||
} from "../../test-utils";
|
||||
|
||||
describe('getForwardableEvent()', () => {
|
||||
const userId = '@alice:server.org';
|
||||
const roomId = '!room:server.org';
|
||||
describe("getForwardableEvent()", () => {
|
||||
const userId = "@alice:server.org";
|
||||
const roomId = "!room:server.org";
|
||||
const client = getMockClientWithEventEmitter({
|
||||
getRoom: jest.fn(),
|
||||
});
|
||||
|
||||
it('returns the event for a room message', () => {
|
||||
it("returns the event for a room message", () => {
|
||||
const alicesMessageEvent = new MatrixEvent({
|
||||
type: EventType.RoomMessage,
|
||||
sender: userId,
|
||||
room_id: roomId,
|
||||
content: {
|
||||
msgtype: MsgType.Text,
|
||||
body: 'Hello',
|
||||
body: "Hello",
|
||||
},
|
||||
});
|
||||
|
||||
expect(getForwardableEvent(alicesMessageEvent, client)).toBe(alicesMessageEvent);
|
||||
});
|
||||
|
||||
it('returns null for a poll start event', () => {
|
||||
const pollStartEvent = makePollStartEvent('test?', userId);
|
||||
it("returns null for a poll start event", () => {
|
||||
const pollStartEvent = makePollStartEvent("test?", userId);
|
||||
|
||||
expect(getForwardableEvent(pollStartEvent, client)).toBe(null);
|
||||
});
|
||||
|
||||
describe('beacons', () => {
|
||||
it('returns null for a beacon that is not live', () => {
|
||||
describe("beacons", () => {
|
||||
it("returns null for a beacon that is not live", () => {
|
||||
const notLiveBeacon = makeBeaconInfoEvent(userId, roomId, { isLive: false });
|
||||
makeRoomWithBeacons(roomId, client, [notLiveBeacon]);
|
||||
|
||||
expect(getForwardableEvent(notLiveBeacon, client)).toBe(null);
|
||||
});
|
||||
|
||||
it('returns null for a live beacon that does not have a location', () => {
|
||||
it("returns null for a live beacon that does not have a location", () => {
|
||||
const liveBeacon = makeBeaconInfoEvent(userId, roomId, { isLive: true });
|
||||
makeRoomWithBeacons(roomId, client, [liveBeacon]);
|
||||
|
||||
expect(getForwardableEvent(liveBeacon, client)).toBe(null);
|
||||
});
|
||||
|
||||
it('returns the latest location event for a live beacon with location', () => {
|
||||
const liveBeacon = makeBeaconInfoEvent(userId, roomId, { isLive: true }, 'id');
|
||||
it("returns the latest location event for a live beacon with location", () => {
|
||||
const liveBeacon = makeBeaconInfoEvent(userId, roomId, { isLive: true }, "id");
|
||||
const locationEvent = makeBeaconEvent(userId, {
|
||||
beaconInfoId: liveBeacon.getId(),
|
||||
geoUri: 'geo:52,42',
|
||||
geoUri: "geo:52,42",
|
||||
// make sure its in live period
|
||||
timestamp: Date.now() + 1,
|
||||
});
|
||||
|
|
|
@ -14,11 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
EventType,
|
||||
MatrixEvent,
|
||||
MsgType,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
import { EventType, MatrixEvent, MsgType } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { getShareableLocationEvent } from "../../../src/events";
|
||||
import {
|
||||
|
@ -29,53 +25,53 @@ import {
|
|||
makeRoomWithBeacons,
|
||||
} from "../../test-utils";
|
||||
|
||||
describe('getShareableLocationEvent()', () => {
|
||||
const userId = '@alice:server.org';
|
||||
const roomId = '!room:server.org';
|
||||
describe("getShareableLocationEvent()", () => {
|
||||
const userId = "@alice:server.org";
|
||||
const roomId = "!room:server.org";
|
||||
const client = getMockClientWithEventEmitter({
|
||||
getRoom: jest.fn(),
|
||||
});
|
||||
|
||||
it('returns null for a non-location event', () => {
|
||||
it("returns null for a non-location event", () => {
|
||||
const alicesMessageEvent = new MatrixEvent({
|
||||
type: EventType.RoomMessage,
|
||||
sender: userId,
|
||||
room_id: roomId,
|
||||
content: {
|
||||
msgtype: MsgType.Text,
|
||||
body: 'Hello',
|
||||
body: "Hello",
|
||||
},
|
||||
});
|
||||
|
||||
expect(getShareableLocationEvent(alicesMessageEvent, client)).toBe(null);
|
||||
});
|
||||
|
||||
it('returns the event for a location event', () => {
|
||||
const locationEvent = makeLocationEvent('geo:52,42');
|
||||
it("returns the event for a location event", () => {
|
||||
const locationEvent = makeLocationEvent("geo:52,42");
|
||||
|
||||
expect(getShareableLocationEvent(locationEvent, client)).toBe(locationEvent);
|
||||
});
|
||||
|
||||
describe('beacons', () => {
|
||||
it('returns null for a beacon that is not live', () => {
|
||||
describe("beacons", () => {
|
||||
it("returns null for a beacon that is not live", () => {
|
||||
const notLiveBeacon = makeBeaconInfoEvent(userId, roomId, { isLive: false });
|
||||
makeRoomWithBeacons(roomId, client, [notLiveBeacon]);
|
||||
|
||||
expect(getShareableLocationEvent(notLiveBeacon, client)).toBe(null);
|
||||
});
|
||||
|
||||
it('returns null for a live beacon that does not have a location', () => {
|
||||
it("returns null for a live beacon that does not have a location", () => {
|
||||
const liveBeacon = makeBeaconInfoEvent(userId, roomId, { isLive: true });
|
||||
makeRoomWithBeacons(roomId, client, [liveBeacon]);
|
||||
|
||||
expect(getShareableLocationEvent(liveBeacon, client)).toBe(null);
|
||||
});
|
||||
|
||||
it('returns the latest location event for a live beacon with location', () => {
|
||||
const liveBeacon = makeBeaconInfoEvent(userId, roomId, { isLive: true }, 'id');
|
||||
it("returns the latest location event for a live beacon with location", () => {
|
||||
const liveBeacon = makeBeaconInfoEvent(userId, roomId, { isLive: true }, "id");
|
||||
const locationEvent = makeBeaconEvent(userId, {
|
||||
beaconInfoId: liveBeacon.getId(),
|
||||
geoUri: 'geo:52,42',
|
||||
geoUri: "geo:52,42",
|
||||
// make sure its in live period
|
||||
timestamp: Date.now() + 1,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue