2023-04-03 13:24:15 +00:00
|
|
|
import {cliTest,createBond, updateRecord} from './helper';
|
2023-03-24 11:32:38 +00:00
|
|
|
|
|
|
|
const args= "record "
|
2023-03-26 20:12:52 +00:00
|
|
|
const filename = "./test/examples/watcher.yml"
|
2023-03-24 11:32:38 +00:00
|
|
|
|
|
|
|
var recordId: string;
|
|
|
|
var bondId: string;
|
|
|
|
|
2023-03-26 20:12:52 +00:00
|
|
|
describe("test record",() => {
|
2023-03-24 11:32:38 +00:00
|
|
|
|
|
|
|
beforeAll(async () => {
|
2023-03-26 20:12:52 +00:00
|
|
|
// get bondId
|
|
|
|
bondId=createBond("aphoton","1000000000")
|
2023-04-03 13:24:15 +00:00
|
|
|
updateRecord(filename)
|
2023-03-24 11:32:38 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("publish record",async ()=>{
|
|
|
|
const resp=cliTest(args+"publish --filename "+filename+" --bond-id "+bondId);
|
2023-04-03 13:24:15 +00:00
|
|
|
expect(resp).toBeDefined();
|
|
|
|
console.log(resp.toString())
|
|
|
|
expect(resp.id).toBeDefined();
|
|
|
|
|
|
|
|
recordId=resp.id
|
2023-03-24 11:32:38 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("get record",async ()=>{
|
|
|
|
const resp=cliTest(args+"get --id "+recordId);
|
2023-04-03 13:24:15 +00:00
|
|
|
expect(resp).toBeDefined();
|
|
|
|
expect(resp.length).toEqual(1);
|
|
|
|
expect(resp[0].id).toEqual(recordId)
|
|
|
|
expect(resp[0].bondId).toEqual(bondId)
|
2023-03-24 11:32:38 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("list records",async ()=>{
|
|
|
|
const resp=cliTest(args+"list");
|
2023-04-03 13:24:15 +00:00
|
|
|
expect(resp).toBeDefined();
|
|
|
|
expect(resp.length).toBeGreaterThan(0);
|
2023-03-24 11:32:38 +00:00
|
|
|
});
|
|
|
|
});
|