-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Replace hardcoded strings with MsgType constants #30179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Unchanged files with check annotations Beta
expect(exporter.destinationFileName).toMatchSnapshot(); | ||
}); | ||
it("should export", async () => { | ||
Check failure on line 193 in test/unit-tests/utils/exportUtils/HTMLExport-test.ts
|
||
const events = [...Array(50)].map<IRoomEvent>((_, i) => ({ | ||
event_id: `${i}`, | ||
type: EventType.RoomMessage, | ||
expect(await file.text()).toMatchSnapshot(); | ||
}); | ||
it("should include the room's avatar", async () => { | ||
Check failure on line 224 in test/unit-tests/utils/exportUtils/HTMLExport-test.ts
|
||
mockMessages(EVENT_MESSAGE); | ||
const mxc = "mxc://www.example.com/avatars/nice-room.jpeg"; | ||
expect(await files["room.png"]!.text()).toBe(avatar); | ||
}); | ||
it("should include the creation event", async () => { | ||
Check failure on line 249 in test/unit-tests/utils/exportUtils/HTMLExport-test.ts
|
||
const creator = "@bob:example.com"; | ||
mockMessages(EVENT_MESSAGE); | ||
room.currentState.setStateEvents([ | ||
expect(await getMessageFile(exporter).text()).toContain(`${creator} created this room.`); | ||
}); | ||
it("should include the topic", async () => { | ||
Check failure on line 280 in test/unit-tests/utils/exportUtils/HTMLExport-test.ts
|
||
const topic = ":^-) (-^:"; | ||
mockMessages(EVENT_MESSAGE); | ||
room.currentState.setStateEvents([ | ||
expect(await getMessageFile(exporter).text()).toContain(`Topic: ${topic}`); | ||
}); | ||
it("should include avatars", async () => { | ||
Check failure on line 311 in test/unit-tests/utils/exportUtils/HTMLExport-test.ts
|
||
mockMessages(EVENT_MESSAGE); | ||
jest.spyOn(RoomMember.prototype, "getMxcAvatarUrl").mockReturnValue("mxc://example.org/avatar.bmp"); | ||
expect(await file.text()).toContain(EVENT_MESSAGE_NO_SENDER.content.body); | ||
}); | ||
it("should handle when events sender cannot be found in room state", async () => { | ||
Check failure on line 371 in test/unit-tests/utils/exportUtils/HTMLExport-test.ts
|
||
mockMessages(EVENT_MESSAGE); | ||
jest.spyOn(RoomState.prototype, "getSentinelMember").mockReturnValue(null); | ||
expect(await file.text()).toContain(EVENT_MESSAGE.content.body); | ||
}); | ||
it("should include attachments", async () => { | ||
Check failure on line 393 in test/unit-tests/utils/exportUtils/HTMLExport-test.ts
|
||
mockMessages(EVENT_MESSAGE, EVENT_ATTACHMENT); | ||
const attachmentBody = "Lorem ipsum dolor sit amet"; | ||
expect(text).toBe(attachmentBody); | ||
}); | ||
it("should handle attachments with identical names and dates", async () => { | ||
Check failure on line 422 in test/unit-tests/utils/exportUtils/HTMLExport-test.ts
|
||
mockMessages(EVENT_MESSAGE, EVENT_ATTACHMENT, EVENT_ATTACHMENT); | ||
const exporter = new HTMLExporter( | ||
expect(duplicateFile).not.toBeUndefined(); | ||
}); | ||
it("should handle when attachment cannot be fetched", async () => { | ||
Check failure on line 452 in test/unit-tests/utils/exportUtils/HTMLExport-test.ts
|
||
mockMessages(EVENT_MESSAGE, EVENT_ATTACHMENT_MALFORMED, EVENT_ATTACHMENT); | ||
const attachmentBody = "Lorem ipsum dolor sit amet"; | ||
expect(await messagesFile.text()).toBeTruthy(); | ||
}); | ||
it("should handle when attachment srcHttp is falsy", async () => { | ||
Check failure on line 485 in test/unit-tests/utils/exportUtils/HTMLExport-test.ts
|
||
mockMessages(EVENT_MESSAGE, EVENT_ATTACHMENT); | ||
const attachmentBody = "Lorem ipsum dolor sit amet"; | ||
expect(messages.messages[0].To[0].Address).toEqual(email); | ||
const text = await mailpit.renderMessageText(messages.messages[0].ID); | ||
[, code] = text.match(/Your verification code to confirm this email address is: (\d{6})/); | ||
}).toPass(); | ||
Check failure on line 39 in playwright/e2e/oidc/index.ts
|
||
await page.getByRole("textbox", { name: "6-digit code" }).fill(code); | ||
await page.getByRole("button", { name: "Continue" }).click(); |
/* | ||
Copyright 2024 New Vector Ltd. | ||
Copyright 2023 The Matrix.org Foundation C.I.C. | ||
await page.route("**/_matrix/client/v3/sendToDevice/m.secret.request/**", async (route) => { | ||
await route.fulfill({ json: {} }); | ||
await new Promise((f) => setTimeout(f, 1000)); | ||
await route.fetch(); | ||
Check failure on line 97 in playwright/e2e/crypto/device-verification.spec.ts
|
||
}); | ||
await logIntoElement(page, credentials); |
await expect(async () => { | ||
await tile.hover(); | ||
await tile.getByRole("button", { name: "Reply", exact: true }).click(); | ||
}).toPass(); | ||
Check failure on line 21 in playwright/e2e/audio-player/audio-player.spec.ts
|
||
}; | ||
test.describe("Audio player", { tag: ["@no-firefox", "@no-webkit"] }, () => { |
const zip = await extractZipFileToPath(zipPath, dirPath); | ||
await page.goto(`file://${dirPath}/${Object.keys(zip.files)[0]}/messages.html`); | ||
await expect(page).toMatchScreenshot("html-export.png", { | ||
Check failure on line 126 in playwright/e2e/chat-export/html-export.spec.ts
|
||
mask: [ | ||
// We need to mask the whole thing because the width of the time part changes | ||
page.locator(".mx_TimelineSeparator"), |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't change
"m.sticker"
here because it makesgetContext
on the next line angry, and I want to keep my first PR small and light.