diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c080b24..87089c9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,6 +2,9 @@ name: Test on: pull_request: + push: + branches: + - "main" jobs: run-tests: @@ -33,4 +36,7 @@ jobs: run: yarn install --frozen-lockfile - name: Run tests - run: yarn test \ No newline at end of file + run: yarn test + + - name: Build + run: yarn build \ No newline at end of file diff --git a/src/execution.test.ts b/src/execution.test.ts index 8d42548..d88f9a6 100644 --- a/src/execution.test.ts +++ b/src/execution.test.ts @@ -36,11 +36,11 @@ const actions = [ describe("execution", () => { it("should encode and decode MINT action correctly", () => { const action = actions[0]; - const encoded = encodeAction(action); + const encoded = encodeAction(action as any); const decoded = decodeAction(encoded); expect(decoded.type).toBe(ActionType.MINT); - expect(decoded.data.hubToAddress).toBe(action.data.hubToAddress); + expect("hubToAddress" in decoded.data && decoded.data.hubToAddress).toBe(action.data.hubToAddress); expect(decoded.data.hubTokenId).toBe(action.data.hubTokenId); expect(decoded.data.amount).toBe(action.data.amount); }); @@ -50,7 +50,7 @@ describe("execution", () => { const encoded = encodeAction(action as any); const decoded = decodeAction(encoded); expect(decoded.type).toBe(ActionType.BURN); - expect(decoded.data.hubFromAddress).toBe(action.data.hubFromAddress); + expect("hubFromAddress" in decoded.data && decoded.data.hubFromAddress).toBe(action.data.hubFromAddress); expect(decoded.data.hubTokenId).toBe(action.data.hubTokenId); expect(decoded.data.amount).toBe(action.data.amount); }); @@ -60,8 +60,8 @@ describe("execution", () => { const encoded = encodeAction(action as any); const decoded = decodeAction(encoded); expect(decoded.type).toBe(ActionType.TRANSFER); - expect(decoded.data.hubFromAddress).toBe(action.data.hubFromAddress); - expect(decoded.data.hubToAddress).toBe(action.data.hubToAddress); + expect("hubFromAddress" in decoded.data && decoded.data.hubFromAddress).toBe(action.data.hubFromAddress); + expect("hubToAddress" in decoded.data && decoded.data.hubToAddress).toBe(action.data.hubToAddress); expect(decoded.data.hubTokenId).toBe(action.data.hubTokenId); expect(decoded.data.amount).toBe(action.data.amount); });