Skip to content

Commit

Permalink
try to update the typescript code
Browse files Browse the repository at this point in the history
  • Loading branch information
yuandrew committed Aug 29, 2024
1 parent 1f2a38c commit 0a51850
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion features/update/async_accepted/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import { Feature } from '@temporalio/harness';
import * as assert from 'assert';
import ms from 'ms';
import { Duration, StringValue } from '@temporalio/common';
import { WorkflowUpdateStage } from '@temporalio/client';

Check failure on line 6 in features/update/async_accepted/feature.ts

View workflow job for this annotation

GitHub Actions / build-ts (ubuntu-latest)

'"@temporalio/client"' has no exported member named 'WorkflowUpdateStage'. Did you mean 'WorkflowUpdateType'?

const myUpdate = wf.defineUpdate<void, [Duration, boolean]>('myUpdate');
const requestedSleep = '2s';

export const feature = new Feature({
workflow,
checkResult: async (_, handle) => {
const timeToAccept = await time(handle.startUpdate(myUpdate, { args: [requestedSleep, false] }));
const timeToAccept = await time(handle.startUpdate(myUpdate, { args: [requestedSleep, false], waitForStage: WorkflowUpdateStage.ACCEPTED }));

Check failure on line 14 in features/update/async_accepted/feature.ts

View workflow job for this annotation

GitHub Actions / build-ts (ubuntu-latest)

No overload matches this call.
const timeToComplete = await time(handle.executeUpdate(myUpdate, { args: [requestedSleep, false] }));
assert.equal(
ms(timeToAccept) < ms(requestedSleep),
Expand Down
6 changes: 3 additions & 3 deletions features/update/basic_async/feature.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WorkflowUpdateFailedError } from '@temporalio/client';
import { WorkflowUpdateFailedError, WorkflowUpdateStage } from '@temporalio/client';

Check failure on line 1 in features/update/basic_async/feature.ts

View workflow job for this annotation

GitHub Actions / build-ts (ubuntu-latest)

'"@temporalio/client"' has no exported member named 'WorkflowUpdateStage'. Did you mean 'WorkflowUpdateType'?
import { Feature } from '@temporalio/harness';
import * as wf from '@temporalio/workflow';
import * as assert from 'assert';
Expand Down Expand Up @@ -29,7 +29,7 @@ export async function workflow(): Promise<string> {
export const feature = new Feature({
workflow,
checkResult: async (runner, handle) => {
const badUpdateHandle = await handle.startUpdate(myUpdate, { args: ['invalid-arg'] });
const badUpdateHandle = await handle.startUpdate(myUpdate, { args: ['invalid-arg'], waitForStage: WorkflowUpdateStage.ACCEPTED });

Check failure on line 32 in features/update/basic_async/feature.ts

View workflow job for this annotation

GitHub Actions / build-ts (ubuntu-latest)

No overload matches this call.
try {
await badUpdateHandle.result();
throw 'Expected update to fail';
Expand All @@ -39,7 +39,7 @@ export const feature = new Feature({
}
}

const updateHandle = await handle.startUpdate(myUpdate, { args: ['update-arg'] });
const updateHandle = await handle.startUpdate(myUpdate, { args: ['update-arg'], waitForStage: WorkflowUpdateStage.ACCEPTED });

Check failure on line 42 in features/update/basic_async/feature.ts

View workflow job for this annotation

GitHub Actions / build-ts (ubuntu-latest)

No overload matches this call.
const updateResult = await updateHandle.result();
assert.equal(updateResult, 'update-result');
const workflowResult = await runner.waitForRunResult(handle);
Expand Down

0 comments on commit 0a51850

Please sign in to comment.