diff --git a/deno.lock b/deno.lock new file mode 100644 index 0000000..402e087 --- /dev/null +++ b/deno.lock @@ -0,0 +1,9 @@ +{ + "version": "2", + "remote": { + "https://deno.land/std@0.165.0/fmt/colors.ts": "9e36a716611dcd2e4865adea9c4bec916b5c60caad4cdcdc630d4974e6bb8bd4", + "https://deno.land/std@0.165.0/testing/_diff.ts": "a23e7fc2b4d8daa3e158fa06856bedf5334ce2a2831e8bf9e509717f455adb2c", + "https://deno.land/std@0.165.0/testing/_format.ts": "cd11136e1797791045e639e9f0f4640d5b4166148796cad37e6ef75f7d7f3832", + "https://deno.land/std@0.165.0/testing/asserts.ts": "1e340c589853e82e0807629ba31a43c84ebdcdeca910c4a9705715dfdb0f5ce8" + } +} diff --git a/fsm.test.ts b/fsm.test.ts index ffbcb1f..add5e17 100644 --- a/fsm.test.ts +++ b/fsm.test.ts @@ -17,9 +17,9 @@ import { assertEquals, + assertRejects, assertThrows, - assertThrowsAsync, -} from "https://deno.land/std@0.105.0/testing/asserts.ts"; +} from "https://deno.land/std@0.165.0/testing/asserts.ts"; import * as fsm from "./fsm.ts"; enum ProjectStatus { @@ -168,7 +168,7 @@ Deno.test("should throw error if transition to the state doesn't exist", () => { const sm = new fsm.StateMachineBuilder() .withStates(Object.values(ProjectStatus)) .build(ProjectStatus.Pending); - assertThrowsAsync( + assertRejects( () => sm.tryChangeState(ProjectStatus.Active, null), fsm.FsmError, `cannot change state from "${ProjectStatus.Pending}" to "${ProjectStatus.Active}"`, @@ -195,7 +195,7 @@ Deno.test("should throw error if beforeExit action returns false", () => { [ProjectStatus.Pending, [ProjectStatus.Active]], ]) .build(ProjectStatus.Pending); - assertThrowsAsync( + assertRejects( () => sm.tryChangeState(ProjectStatus.Active, null), fsm.FsmError, `cannot change state from "${ProjectStatus.Pending}" to "${ProjectStatus.Active}"`,