From b7a8e7c2344d7cea37f16834e4c617c9c07c6c61 Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Wed, 29 Mar 2023 17:10:00 +0530 Subject: [PATCH] refactor helper funcs --- test/helper.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/test/helper.ts b/test/helper.ts index 8264a6c..7114aef 100644 --- a/test/helper.ts +++ b/test/helper.ts @@ -10,19 +10,14 @@ export const cliTest = (args: any) => { export function createBond(type: string, quantity: string):string{ const resp=cliTest("bond create --type aphoton --quantity 1000000000"); - expect(resp).toBeDefined; - - // refactor to get bondId from create resp - const list=cliTest("bond list"); - const bondId=JSON.parse(list)[0].id - expect(resp).toBeDefined; - return bondId + expect(resp.bondId).toBeDefined(); + return resp.bondId }; export function createRecord(filepath: string, bondId: string):string{ const resp=cliTest("record publish --filename "+filepath+" --bond-id "+bondId); - const recordId = resp.substring(resp.indexOf(":")+3,resp.indexOf("}")-2) - return recordId + expect(resp.id).toBeDefined(); + return resp.id } export function createAuthority(name:string):string{