Skip to content

Commit 4191910

Browse files
committed
Fix lint failures in test and skill script
1 parent 073a6d5 commit 4191910

2 files changed

Lines changed: 19 additions & 11 deletions

File tree

skills/x-get-scheduled-posts/scripts/export_scheduled_posts.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env node
22

33
import fs from 'node:fs';
4+
import process from 'node:process';
45

56
function parseArgs(argv) {
67
const args = {};
@@ -100,7 +101,7 @@ function main() {
100101
);
101102
fs.writeFileSync(listMdFile, `${buildMarkdown(stamp, items)}\n`);
102103

103-
console.log(
104+
globalThis.console.log(
104105
JSON.stringify(
105106
{
106107
ok: true,

tests/server.test.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,26 @@ function createSessionMock(): { session: BrowserSession; mocks: SessionMocks } {
4444
};
4545
}
4646

47-
function createMockCdpClient(): CdpClient {
47+
function createMockCdpClient(): {
48+
client: CdpClient;
49+
send: ReturnType<typeof vi.fn>;
50+
} {
51+
const send = vi.fn(() => Promise.resolve({}));
52+
4853
return {
49-
send: vi.fn(() => Promise.resolve({})),
50-
close: vi.fn(() => Promise.resolve()),
51-
isConnected: true
52-
} as unknown as CdpClient;
54+
client: {
55+
send,
56+
close: vi.fn(() => Promise.resolve()),
57+
isConnected: true
58+
} as unknown as CdpClient,
59+
send
60+
};
5361
}
5462

5563
function createServerOptions(overrides?: { evaluateEnabled?: boolean }) {
5664
const { session, mocks } = createSessionMock();
5765
const snapshotEngine = new SnapshotEngine();
58-
const mockCdp = createMockCdpClient();
66+
const { client: mockCdp, send: mockCdpSend } = createMockCdpClient();
5967

6068
const app = createControlServer({
6169
session,
@@ -65,7 +73,7 @@ function createServerOptions(overrides?: { evaluateEnabled?: boolean }) {
6573
cdpHttpEndpoint: 'http://127.0.0.1:19999'
6674
});
6775

68-
return { app, session, mocks, snapshotEngine, mockCdp };
76+
return { app, session, mocks, snapshotEngine, mockCdp, mockCdpSend };
6977
}
7078

7179
async function requestLocal(
@@ -215,8 +223,7 @@ describe('control server routes', () => {
215223

216224
test('POST /file-input calls CDP DOM commands', async () => {
217225
const opts = createServerOptions();
218-
const mockCdp = opts.mockCdp;
219-
const sendMock = mockCdp.send as ReturnType<typeof vi.fn>;
226+
const sendMock = opts.mockCdpSend;
220227

221228
// Mock DOM.getDocument to return a root node
222229
sendMock.mockImplementation((method: string) => {
@@ -253,7 +260,7 @@ describe('control server routes', () => {
253260

254261
test('POST /file-input returns 400 when element not found', async () => {
255262
const opts = createServerOptions();
256-
const sendMock = opts.mockCdp.send as ReturnType<typeof vi.fn>;
263+
const sendMock = opts.mockCdpSend;
257264

258265
sendMock.mockImplementation((method: string) => {
259266
if (method === 'DOM.getDocument') {

0 commit comments

Comments
 (0)