Merge pull request #28626 from element-hq/t3chguy/web-friendly-buffers

Remove usages of Buffer so we don't need to ship the polyfill
This commit is contained in:
Michael Telatynski 2024-12-04 22:10:30 +00:00 committed by GitHub
commit 085854b125
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 24 additions and 34 deletions

View file

@ -418,7 +418,7 @@ describe("Lifecycle", () => {
undefined,
);
expect(MatrixClientPeg.start).toHaveBeenCalledWith({ rustCryptoStoreKey: expect.any(Buffer) });
expect(MatrixClientPeg.start).toHaveBeenCalledWith({ rustCryptoStoreKey: expect.any(Uint8Array) });
});
describe("with a refresh token", () => {

View file

@ -17,7 +17,9 @@ describe("<VerificationQRCode />", () => {
});
it("renders a QR code", async () => {
const { container, getAllByAltText } = render(<VerificationQRCode qrCodeBytes={Buffer.from("asd")} />);
const { container, getAllByAltText } = render(
<VerificationQRCode qrCodeBytes={new Uint8ClampedArray(Buffer.from("asd"))} />,
);
// wait for the spinner to go away
await waitFor(() => getAllByAltText("QR Code").length === 1);
expect(container).toMatchSnapshot();

View file

@ -46,7 +46,7 @@ describe("<VerificationPanel />", () => {
const request = makeMockVerificationRequest({
phase: Phase.Ready,
});
request.generateQRCode.mockResolvedValue(Buffer.from("test", "utf-8"));
request.generateQRCode.mockResolvedValue(new Uint8ClampedArray(Buffer.from("test", "utf-8")));
const container = renderComponent({
request: request,
layout: "dialog",
@ -71,7 +71,7 @@ describe("<VerificationPanel />", () => {
const request = makeMockVerificationRequest({
phase: Phase.Ready,
});
request.generateQRCode.mockResolvedValue(Buffer.from("test", "utf-8"));
request.generateQRCode.mockResolvedValue(new Uint8ClampedArray(Buffer.from("test", "utf-8")));
const container = renderComponent({
request: request,
member: new User("@other:user"),