Skip to content

Commit

Permalink
types
Browse files Browse the repository at this point in the history
  • Loading branch information
josephjclark committed Aug 22, 2024
1 parent beb63ab commit 9c45cb0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
4 changes: 2 additions & 2 deletions packages/ws-worker/src/util/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ type Args = {
log?: LogLevel;
lightningPublicKey?: string;
mock?: boolean;
backoff?: string;
backoff: string;
capacity?: number;
runMemory?: number;
payloadMemory?: number;
statePropsToRemove?: string[];
maxRunDurationSeconds?: number;
maxRunDurationSeconds: number;
socketTimeoutSeconds?: number;
};

Expand Down
40 changes: 25 additions & 15 deletions packages/ws-worker/test/channels/worker-queue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,21 @@ const logger = createMockLogger();

test('should connect', async (t) => {
return new Promise((done) => {
connectToWorkerQueue('www', 'a', 'secret', logger, mockSocket as any).on(
'connect',
({ socket, channel }) => {
t.truthy(socket);
t.truthy(socket.connect);
t.truthy(channel);
t.truthy(channel.join);
t.pass('connected');
done();
}
);
connectToWorkerQueue(
'www',
'a',
'secret',
undefined,
logger,
mockSocket as any
).on('connect', ({ socket, channel }) => {
t.truthy(socket);
t.truthy(socket.connect);
t.truthy(channel);
t.truthy(channel.join);
t.pass('connected');
done();
});
});
});

Expand All @@ -45,6 +49,7 @@ test('should connect with an auth token', async (t) => {
'www',
workerId,
secret,
undefined,
logger,
createSocket as any
).on('connect', ({ socket, channel }) => {
Expand Down Expand Up @@ -74,10 +79,14 @@ test('should connect with api and worker versions', async (t) => {
return socket;
}

connectToWorkerQueue('www', 'a', 'secret', logger, createSocket as any).on(
'connect',
done
);
connectToWorkerQueue(
'www',
'a',
'secret',
undefined,
logger,
createSocket as any
).on('connect', done);
});
});

Expand Down Expand Up @@ -105,6 +114,7 @@ test('should fail to connect with an invalid auth token', async (t) => {
'www',
workerId,
'wrong-secret!',
undefined,
logger,
createSocket as any
).on('error', (e) => {
Expand Down

0 comments on commit 9c45cb0

Please sign in to comment.