Example #1
0
export const credentialCreateWithMsgId = async (data?: ICredentialCreateWithMsgId) => {
  if (!data) {
    data = await dataCredentialCreateWithMsgId()
  }
  const credential = await Credential.createWithMsgId(data)
  assert.notEqual(credential.handle, undefined)
  assert.equal(credential.sourceId, data.sourceId)
  assert.ok(credential.credOffer)
  return credential
}
 it('should accept tsconfigs that typescript accepts', () => {
   assert.ok(
     withCustomConfig(
       // need to navigate to root because tests run on compiled tests
       // and tsc does not include json files
       path.join(__dirname, '../../src/__tests__/data/tsconfig.json'),
       {}
     )
   );
 });
Example #3
0
  it('can compile a unifying object matcher', () => {
    let match = compileMatcher({ foo: simple('x'), bar: simple('y'), baz: simple('x') });
    let successContext = new Context();
    assert.ok(match({ foo: 1, bar: 2, baz: 1 }, successContext));
    assert.deepEqual(flattenPrototype(successContext.expose()), { x: 1, y: 2 });

    let failureContext = new Context();
    assert.notOk(match({ foo: 1, bar: 2, baz: 3 }, failureContext));
    assert.deepEqual(flattenPrototype(failureContext.expose()), {});
  });
 @test('createOrder() completes without throwing an error')
 public async createOrderForValidData() {
   let { id } = await createOrder(VALID_ORDER_DATA, [
     { productid: 1, quantity: 3, discount: 0, unitprice: 3.0 }
   ]);
   if (typeof id === 'undefined') {
     throw new Error('createOrder() should return an object with an id');
   }
   assert.ok(id, 'createOrder() returns an object with an id');
 }
Example #5
0
export const disclosedProofCreateWithMsgId = async (data?: IDisclosedProofCreateWithMsgIdData) => {
  if (!data) {
    data = await dataDisclosedProofCreateWithMsgId()
  }
  const disclousedProof = await DisclosedProof.createWithMsgId(data)
  assert.notEqual(disclousedProof.handle, undefined)
  assert.equal(disclousedProof.sourceId, data.sourceId)
  assert.ok(disclousedProof.proofRequest)
  return disclousedProof
}
Example #6
0
 .then((deployUnit) => {
   assert.ok(deployUnit.id);
   assert.equal(deployUnit.name, newDu.name);
   assert.equal(deployUnit.version, newDu.version);
   assert.equal(deployUnit.platform, newDu.platform);
   assert.equal(deployUnit.tdefName, 'Ticker');
   assert.equal(deployUnit.tdefVersion, 3);
   assert.equal(deployUnit.namespace, 'kevoree');
   createdDu = deployUnit;
 });
Example #7
0
 .then((deployUnit) => {
   assert.ok(deployUnit.id);
   assert.equal(deployUnit.namespace, createdDu.namespace);
   assert.equal(deployUnit.tdefName, createdDu.tdefName);
   assert.equal(deployUnit.tdefVersion, createdDu.tdefVersion);
   assert.equal(deployUnit.name, createdDu.name);
   assert.equal(deployUnit.version, createdDu.version);
   assert.equal(deployUnit.platform, createdDu.platform);
   assert.equal(deployUnit.model, createdDu.model);
 });
Example #8
0
  it('can compile an object matcher with an unbound rest matcher', () => {
    let match = compileMatcher({ foo: simple('x'), ...rest() });
    let successContext = new Context();
    assert.ok(match({ foo: 1, bar: 2, baz: 3 }, successContext));
    assert.deepEqual(flattenPrototype(successContext.expose()), { x: 1 });

    let failureContext = new Context();
    assert.notOk(match({ bar: 2, baz: 3 }, failureContext));
    assert.deepEqual(flattenPrototype(failureContext.expose()), {});
  });
Example #9
0
  it('can compile an array matcher with an unbound rest matcher', () => {
    let match = compileMatcher([simple('x'), ...rest()]);
    let successContext = new Context();
    assert.ok(match([1, 2, 3], successContext));
    assert.deepEqual(flattenPrototype(successContext.expose()), { x: 1 });

    let failureContext = new Context();
    assert.notOk(match([{}, 2, 3], failureContext));
    assert.deepEqual(flattenPrototype(failureContext.expose()), {});
  });
Example #10
0
  it('can compile a unifying array matcher', () => {
    let match = compileMatcher([simple('x'), simple('y'), simple('x')]);
    let successContext = new Context();
    assert.ok(match([1, 2, 1], successContext));
    assert.deepEqual(flattenPrototype(successContext.expose()), { x: 1, y: 2 });

    let failureContext = new Context();
    assert.notOk(match([1, 2, 3], failureContext));
    assert.deepEqual(flattenPrototype(failureContext.expose()), {});
  });