chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -23,9 +23,7 @@ const mockLoadConfig = vi.fn().mockReturnValue({
|
||||
});
|
||||
|
||||
const readAllowFromStoreMock = vi.fn().mockResolvedValue([]);
|
||||
const upsertPairingRequestMock = vi
|
||||
.fn()
|
||||
.mockResolvedValue({ code: "PAIRCODE", created: true });
|
||||
const upsertPairingRequestMock = vi.fn().mockResolvedValue({ code: "PAIRCODE", created: true });
|
||||
|
||||
vi.mock("../config/config.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("../config/config.js")>();
|
||||
@@ -36,10 +34,8 @@ vi.mock("../config/config.js", async (importOriginal) => {
|
||||
});
|
||||
|
||||
vi.mock("../pairing/pairing-store.js", () => ({
|
||||
readChannelAllowFromStore: (...args: unknown[]) =>
|
||||
readAllowFromStoreMock(...args),
|
||||
upsertChannelPairingRequest: (...args: unknown[]) =>
|
||||
upsertPairingRequestMock(...args),
|
||||
readChannelAllowFromStore: (...args: unknown[]) => readAllowFromStoreMock(...args),
|
||||
upsertChannelPairingRequest: (...args: unknown[]) => upsertPairingRequestMock(...args),
|
||||
}));
|
||||
|
||||
vi.mock("./session.js", () => {
|
||||
@@ -68,8 +64,7 @@ vi.mock("./session.js", () => {
|
||||
});
|
||||
|
||||
const { createWaSocket } = await import("./session.js");
|
||||
const _getSock = () =>
|
||||
(createWaSocket as unknown as () => Promise<ReturnType<typeof mockSock>>)();
|
||||
const _getSock = () => (createWaSocket as unknown as () => Promise<ReturnType<typeof mockSock>>)();
|
||||
|
||||
import fsSync from "node:fs";
|
||||
import os from "node:os";
|
||||
@@ -143,10 +138,7 @@ describe("web monitor inbox", () => {
|
||||
},
|
||||
]);
|
||||
expect(sock.sendPresenceUpdate).toHaveBeenCalledWith("available");
|
||||
expect(sock.sendPresenceUpdate).toHaveBeenCalledWith(
|
||||
"composing",
|
||||
"999@s.whatsapp.net",
|
||||
);
|
||||
expect(sock.sendPresenceUpdate).toHaveBeenCalledWith("composing", "999@s.whatsapp.net");
|
||||
expect(sock.sendMessage).toHaveBeenCalledWith("999@s.whatsapp.net", {
|
||||
text: "pong",
|
||||
});
|
||||
@@ -199,13 +191,8 @@ describe("web monitor inbox", () => {
|
||||
authDir,
|
||||
});
|
||||
const sock = await createWaSocket();
|
||||
const getPNForLID = vi.spyOn(
|
||||
sock.signalRepository.lidMapping,
|
||||
"getPNForLID",
|
||||
);
|
||||
sock.signalRepository.lidMapping.getPNForLID.mockResolvedValueOnce(
|
||||
"999:0@s.whatsapp.net",
|
||||
);
|
||||
const getPNForLID = vi.spyOn(sock.signalRepository.lidMapping, "getPNForLID");
|
||||
sock.signalRepository.lidMapping.getPNForLID.mockResolvedValueOnce("999:0@s.whatsapp.net");
|
||||
const upsert = {
|
||||
type: "notify",
|
||||
messages: [
|
||||
@@ -245,10 +232,7 @@ describe("web monitor inbox", () => {
|
||||
authDir,
|
||||
});
|
||||
const sock = await createWaSocket();
|
||||
const getPNForLID = vi.spyOn(
|
||||
sock.signalRepository.lidMapping,
|
||||
"getPNForLID",
|
||||
);
|
||||
const getPNForLID = vi.spyOn(sock.signalRepository.lidMapping, "getPNForLID");
|
||||
const upsert = {
|
||||
type: "notify",
|
||||
messages: [
|
||||
@@ -284,13 +268,8 @@ describe("web monitor inbox", () => {
|
||||
authDir,
|
||||
});
|
||||
const sock = await createWaSocket();
|
||||
const getPNForLID = vi.spyOn(
|
||||
sock.signalRepository.lidMapping,
|
||||
"getPNForLID",
|
||||
);
|
||||
sock.signalRepository.lidMapping.getPNForLID.mockResolvedValueOnce(
|
||||
"444:0@s.whatsapp.net",
|
||||
);
|
||||
const getPNForLID = vi.spyOn(sock.signalRepository.lidMapping, "getPNForLID");
|
||||
sock.signalRepository.lidMapping.getPNForLID.mockResolvedValueOnce("444:0@s.whatsapp.net");
|
||||
const upsert = {
|
||||
type: "notify",
|
||||
messages: [
|
||||
|
||||
Reference in New Issue
Block a user