Skip to content

Commit

Permalink
tx-signing-js: added test for Value of type Coll[SigmaProp]
Browse files Browse the repository at this point in the history
  • Loading branch information
aslesarenko committed Aug 18, 2023
1 parent 9917c2b commit 3d5c498
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sigma-js/sigmastate-js.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ declare module "sigmastate-js/main" {
static ofGroupElement(pointHex: string): Value<GroupElement>;
static ofSigmaProp(pointHex: string): Value<SigmaProp>;
static pairOf<R, L>(left: Value<R>, right: Value<L>): Value<[R, L]>;
static collOf<T>(items: T[], type: Type): Value<T[]>;
static collOf<T>(items: T[], elemType: Type): Value<T[]>;
static fromHex<T>(hex: HexString): Value<T>;
}

Expand Down
10 changes: 9 additions & 1 deletion sigma-js/tests/js/Value.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { TypeObj, ValueObj } = require("sigmastate-js/main");
const { TypeObj, ValueObj, SigmaPropObj, SigmaProp} = require("sigmastate-js/main");

function testRange(factory, min, max) {
expect(factory(max).data).toEqual(max);
Expand Down Expand Up @@ -105,6 +105,14 @@ describe("Smoke tests for Values", () => {
expect(collV.toHex()).toEqual(collHex)
});

it("Value of type Coll[SigmaProp]", () => {
let sp1 = SigmaPropObj.fromPointHex(groupElementHex.substring(2))
let sp2 = SigmaPropObj.fromPointHex(sigmaPropHex.substring(4))
let collV = ValueObj.collOf([sp1, sp2], TypeObj.SigmaProp)

expect(collV.tpe.name).toEqual("Coll[SigmaProp]");
});

it("Pair Value.toHex", () => {
let fst = ValueObj.ofByte(10)
let snd = ValueObj.ofLong(20)
Expand Down

0 comments on commit 3d5c498

Please sign in to comment.