Skip to content

Commit

Permalink
Fix Tx Submission Tests with Error Handling
Browse files Browse the repository at this point in the history
  • Loading branch information
edridudi committed May 2, 2023
1 parent 379e787 commit c013492
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 23 deletions.
19 changes: 10 additions & 9 deletions src/test/MainnetService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,14 @@ describe("koiosTransactionsService", () => {
console.log(result)
expect(result).not.toBe(null)
});
test("submitTransaction", async () => {
const uint8 = new Uint8Array([0])
let result
result = await koiosTransactionsService.submitTransaction(uint8)
expect(result).toBeInstanceOf(KoiosHttpError)
expect(result).not.toBe(null)
expect(result.statusCode).toBe(400)
test("submitTransactionBadRequest", async () => {
try {
await koiosTransactionsService.submitTransaction(new Uint8Array([0]))
} catch (e) {
expect(e).toBeInstanceOf(KoiosHttpError)
expect(e).not.toBe(null)
expect(e.statusCode).toBe(400)
}
});
test("getTransactionStatus", async () => {
const txHashes = [
Expand Down Expand Up @@ -243,7 +244,7 @@ describe("koiosAssetService", () => {
console.log(result)
expect(result).not.toBe(null)
});
test("getPolicyAssetAddressList", async () => {
test("mainnetGetPolicyAssetAddressList", async () => {
const result = await koiosAssetService.getPolicyAssetAddressList("750900e4999ebe0d58f19b634768ba25e525aaf12403bfe8fe130501")
console.log(result)
expect(result).not.toBe(null)
Expand Down Expand Up @@ -334,7 +335,7 @@ describe("koiosPoolService", () => {
});

describe("koiosScriptService", () => {
test("getNativeScriptList", async () => {
test("mainnetGetNativeScriptList", async () => {
const result = await koiosScriptService.getNativeScriptList()
console.log(result)
expect(result).not.toBe(null)
Expand Down
16 changes: 9 additions & 7 deletions src/test/PreprodService.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {BackendFactory} from "../index";
import {BackendFactory, KoiosHttpError} from "../index";
import {describe, expect, test} from "vitest";

const koiosPreprodService = BackendFactory.getKoiosPreprodService()
Expand Down Expand Up @@ -122,12 +122,14 @@ describe("koiosTransactionsService", () => {
console.log(result)
expect(result).not.toBe(null)
});
test("submitTransaction", async () => {
const uint8 = new Uint8Array([0])
const result = await koiosTransactionsService.submitTransaction(uint8)
console.log(result)
expect(result).not.toBe(null)
expect(result.statusCode).toBe(400)
test("submitTransactionBadRequest", async () => {
try {
await koiosTransactionsService.submitTransaction(new Uint8Array([0]))
} catch (e) {
expect(e).toBeInstanceOf(KoiosHttpError)
expect(e).not.toBe(null)
expect(e.statusCode).toBe(400)
}
});
test("getTransactionStatus", async () => {
const txHashes = [
Expand Down
16 changes: 9 additions & 7 deletions src/test/PreviewService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
LogicalOperatorFilter,
LogicalOperatorFilterType,
NotOperatorFilter,
SortType,
SortType, KoiosHttpError,
} from "../index";

import {describe, expect, test} from "vitest";
Expand Down Expand Up @@ -142,12 +142,14 @@ describe("koiosTransactionsService", () => {
console.log(result)
expect(result).not.toBe(null)
});
test("submitTransaction", async () => {
const uint8 = new Uint8Array([0])
const result = await koiosTransactionsService.submitTransaction(uint8)
console.log(result)
expect(result).not.toBe(null)
expect(result.statusCode).toBe(400)
test("submitTransactionBadRequest", async () => {
try {
await koiosTransactionsService.submitTransaction(new Uint8Array([0]))
} catch (e) {
expect(e).toBeInstanceOf(KoiosHttpError)
expect(e).not.toBe(null)
expect(e.statusCode).toBe(400)
}
});
test("getTransactionStatus", async () => {
const txHashes = [
Expand Down

0 comments on commit c013492

Please sign in to comment.