Skip to content

Commit ab2bd73

Browse files
committed
use Client instead of WorkflowClient
1 parent 2a7168b commit ab2bd73

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

packages/test/src/test-serialization-context.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { randomUUID } from 'crypto';
2-
import { WorkflowClient, WorkflowFailedError } from '@temporalio/client';
2+
import { Client, WorkflowFailedError } from '@temporalio/client';
33
import { workflowInterceptorModules } from '@temporalio/testing';
44
import { bundleWorkflowCode } from '@temporalio/worker';
55
import { decodeOptionalSinglePayload } from '@temporalio/common/lib/internal-non-workflow';
@@ -56,8 +56,8 @@ const test = makeConfigurableEnvironmentTestFn<Context>({
5656
},
5757
});
5858

59-
function makeClient(env: TestWorkflowEnvironment): WorkflowClient {
60-
return new WorkflowClient({
59+
function makeClient(env: TestWorkflowEnvironment): Client {
60+
return new Client({
6161
connection: env.client.connection,
6262
namespace: env.client.options.namespace,
6363
dataConverter,
@@ -89,7 +89,7 @@ test('workflow start/result payloads carry workflow context', async (t) => {
8989
const workflowId = `wf-id-${randomUUID()}`;
9090
const wf = workflowCtx(workflowId);
9191
await worker.runUntil(async () => {
92-
const handle = await client.start(currentWorkflowContext, {
92+
const handle = await client.workflow.start(currentWorkflowContext, {
9393
args: [makeContextTrace('wf-input')],
9494
workflowId,
9595
taskQueue: h.taskQueue,
@@ -109,7 +109,7 @@ test('query/signal/update carry workflow context', async (t) => {
109109
const workflowId = `wf-id-${randomUUID()}`;
110110
const wf = workflowCtx(workflowId);
111111
await worker.runUntil(async () => {
112-
const handle = await client.start(messagePassingContexts, {
112+
const handle = await client.workflow.start(messagePassingContexts, {
113113
workflowId,
114114
taskQueue: h.taskQueue,
115115
});
@@ -140,7 +140,7 @@ test('activity carries serialization context', async (t) => {
140140
const wf = workflowCtx(workflowId);
141141
const act = activityCtx(workflowId);
142142
await worker.runUntil(async () => {
143-
const handle = await client.start(wfContextWithRemoteActivity, {
143+
const handle = await client.workflow.start(wfContextWithRemoteActivity, {
144144
args: [makeContextTrace('wf-input')],
145145
workflowId,
146146
taskQueue: h.taskQueue,
@@ -173,7 +173,7 @@ test('activity heartbeat carries workflow context', async (t) => {
173173
const wf = workflowCtx(workflowId);
174174
const act = activityCtx(workflowId);
175175
await worker.runUntil(async () => {
176-
const handle = await client.start(wfContextWithHeartbeatDetails, {
176+
const handle = await client.workflow.start(wfContextWithHeartbeatDetails, {
177177
args: [makeContextTrace('wf-input')],
178178
workflowId,
179179
taskQueue: h.taskQueue,
@@ -205,7 +205,7 @@ test('local activity carries serialization context', async (t) => {
205205
const wf = workflowCtx(workflowId);
206206
const localAct = activityCtx(workflowId, '1', true);
207207
await worker.runUntil(async () => {
208-
const handle = await client.start(wfContextWithLocalActivity, {
208+
const handle = await client.workflow.start(wfContextWithLocalActivity, {
209209
args: [makeContextTrace('wf-input')],
210210
workflowId,
211211
taskQueue: h.taskQueue,
@@ -234,7 +234,7 @@ test('workflow continue-as-new carry workflow context', async (t) => {
234234
const workflowId = `wf-id-${randomUUID()}`;
235235
const wf = workflowCtx(workflowId);
236236
await worker.runUntil(async () => {
237-
const handle = await client.start(wfContextWithContinueAsNew, {
237+
const handle = await client.workflow.start(wfContextWithContinueAsNew, {
238238
args: [makeContextTrace('wf-input'), true],
239239
workflowId,
240240
taskQueue: h.taskQueue,
@@ -263,7 +263,7 @@ test('child workflow carry workflow context', async (t) => {
263263
const wf = workflowCtx(workflowId);
264264
const childWf = workflowCtx(childId);
265265
await worker.runUntil(async () => {
266-
const handle = await client.start(wfContextWithChildWorkflow, {
266+
const handle = await client.workflow.start(wfContextWithChildWorkflow, {
267267
args: [makeContextTrace('parent-wf-input'), childId],
268268
workflowId,
269269
taskQueue: h.taskQueue,
@@ -293,7 +293,7 @@ test('workflow failure carries workflow failure context', async (t) => {
293293
const wf = workflowCtx(workflowId);
294294

295295
await worker.runUntil(async () => {
296-
const handle = await client.start(wfFailureContext, {
296+
const handle = await client.workflow.start(wfFailureContext, {
297297
workflowId,
298298
taskQueue: h.taskQueue,
299299
});
@@ -317,7 +317,7 @@ test('activity failure observed by workflow carries workflow decode context', as
317317
const act = activityCtx(workflowId);
318318

319319
await worker.runUntil(async () => {
320-
const handle = await client.start(wfActivityFailureContext, {
320+
const handle = await client.workflow.start(wfActivityFailureContext, {
321321
workflowId,
322322
taskQueue: h.taskQueue,
323323
});
@@ -333,7 +333,7 @@ test('external signal failure carries target workflow decode context', async (t)
333333
const worker = await h.createWorker({ dataConverter });
334334
const missingWfId = `missing-wf-id-${randomUUID()}`;
335335
await worker.runUntil(async () => {
336-
const handle = await client.start(wfExternalSignalFailureContext, {
336+
const handle = await client.workflow.start(wfExternalSignalFailureContext, {
337337
workflowId: `wf-id-${randomUUID()}`,
338338
taskQueue: h.taskQueue,
339339
args: [missingWfId],
@@ -354,7 +354,7 @@ test('external cancel failure carries target workflow decode context', async (t)
354354
const missingWfId = `missing-wf-id-${randomUUID()}`;
355355

356356
await worker.runUntil(async () => {
357-
const handle = await client.start(wfExternalCancelFailureContext, {
357+
const handle = await client.workflow.start(wfExternalCancelFailureContext, {
358358
workflowId: `wf-id-${randomUUID()}`,
359359
taskQueue: h.taskQueue,
360360
args: [missingWfId],
@@ -376,7 +376,7 @@ test('workflow upsertMemo carries workflow context on encode', async (t) => {
376376
const wf = workflowCtx(workflowId);
377377

378378
await worker.runUntil(async () => {
379-
const handle = await client.start(wfContextWithUpsertMemo, {
379+
const handle = await client.workflow.start(wfContextWithUpsertMemo, {
380380
args: [makeContextTrace('wf-input')],
381381
workflowId,
382382
taskQueue: h.taskQueue,
@@ -407,7 +407,7 @@ test('timer summary still serializes', async (t) => {
407407
const workflowId = `wf-id-${randomUUID()}`;
408408

409409
await worker.runUntil(async () => {
410-
await client.execute(wfContextWithTimerSummary, {
410+
await client.workflow.execute(wfContextWithTimerSummary, {
411411
args: [makeContextTrace('wf-input')],
412412
workflowId,
413413
taskQueue: h.taskQueue,
@@ -442,7 +442,7 @@ test('workflow with many payload boundaries', async (t) => {
442442
const act = activityCtx(workflowId, '1', false);
443443
const localAct = activityCtx(workflowId, '2', true);
444444
await worker.runUntil(async () => {
445-
const handle = await client.start(wfContextSmoke, {
445+
const handle = await client.workflow.start(wfContextSmoke, {
446446
args: [makeContextTrace('wf-input'), true, childId],
447447
workflowId,
448448
taskQueue: h.taskQueue,
@@ -504,7 +504,7 @@ test('external signal success carries target workflow context', async (t) => {
504504
const childWf = workflowCtx(childId);
505505

506506
await worker.runUntil(async () => {
507-
const handle = await client.start(wfExternalSignalSuccessContext, {
507+
const handle = await client.workflow.start(wfExternalSignalSuccessContext, {
508508
args: [makeContextTrace('wf-input'), childId],
509509
workflowId,
510510
taskQueue: h.taskQueue,
@@ -536,7 +536,7 @@ test('child workflow failure observed by parent carries child workflow decode co
536536
const childWf = workflowCtx(childId);
537537

538538
await worker.runUntil(async () => {
539-
const handle = await client.start(wfChildWorkflowFailureContext, {
539+
const handle = await client.workflow.start(wfChildWorkflowFailureContext, {
540540
args: [childId],
541541
workflowId,
542542
taskQueue: h.taskQueue,
@@ -558,7 +558,7 @@ test('local activity failure observed by workflow carries local activity decode
558558
const localAct = activityCtx(workflowId, '1', true);
559559

560560
await worker.runUntil(async () => {
561-
const handle = await client.start(wfLocalActivityFailureContext, {
561+
const handle = await client.workflow.start(wfLocalActivityFailureContext, {
562562
workflowId,
563563
taskQueue: h.taskQueue,
564564
});

0 commit comments

Comments
 (0)