How to use the chai.assert.isDefined function in chai

To help you get started, we’ve selected a few chai examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AugurProject / augur / test / assertions / loginAccount.js View on Github external
// loginAccount.id
	assert.isDefined(actual.id, `loginAccount.id isn't defined`);
	assert.isString(actual.id, `loginAccount.id isn't a string`);

	// loginAccount.linkText
	assert.isDefined(actual.linkText, `loginAccount.linkText isn't defined`);
	assert.isString(actual.linkText, `loginAccount.linkText isn't a string`);

	// loginAccount.prettySecureLoginID
	assert.isDefined(actual.prettySecureLoginID, `loginAccount.prettySecureLoginID isn't defined`);
	assert.isString(actual.prettySecureLoginID, `loginAccount.prettySecureLoginID isn't a string`);

	// loginAccount.rep
	assert.isDefined(actual.rep, `loginAccount.rep isn't defined`);
	assert.isObject(actual.rep , `loginAccount.rep isn't an object`);
	assert.isDefined(actual.rep.value, `loginAccount.rep.value isn't defined`);
	assert.isNumber(actual.rep.value, `loginAccount.rep.value isn't a number`);
	assert.isDefined(actual.rep.formattedValue, `loginAccount.rep.formattedValue isn't defined`);
	assert.isNumber(actual.rep.formattedValue, `loginAccount.rep.formattedValue isn't a number`);
	assert.isDefined(actual.rep.formatted, `loginAccount.rep.formatted isn't defined`);
	assert.isString(actual.rep.formatted, `loginAccount.rep.formatted isn't a string`);
	assert.isDefined(actual.rep.rounded, `loginAccount.rep.rounded isn't defined`);
	assert.isString(actual.rep.rounded, `loginAccount.rep.rounded isn't a string`);
	assert.isDefined(actual.rep.minimized, `loginAccount.rep.minimized isn't defined`);
	assert.isString(actual.rep.minimized, `loginAccount.rep.minimized isn't a string`);
	assert.isDefined(actual.rep.full, `loginAccount.rep.full isn't defined`);
	assert.isString(actual.rep.full, `loginAccount.rep.full isn't a string`);
	assert.isDefined(actual.rep.denomination, `loginAccount.rep.denomination isn't defined`);
	assert.isString(actual.rep.denomination, `loginAccount.rep.denomination isn't a string`);
	// assert.equal(actual.rep.denomination, 'rep', `loginAccount.rep.denomination isn't 'rep'`);

	// loginAccount.ether
github ProjectOpenSea / opensea-js / test / seaport / orders.ts View on Github external
const makerAddress = ALEX_ADDRESS_2
    const takerAddress = ALEX_ADDRESS
    const matcherAddress = DEVIN_ADDRESS
    const now = Date.now() / 1000
    // Get bid from server
    const paymentTokenAddress = wethAddress
    const { orders } = await rinkebyClient.api.getOrders({
      side: OrderSide.Buy,
      asset_contract_address: CK_RINKEBY_ADDRESS,
      token_id: CK_RINKEBY_TOKEN_ID,
      payment_token_address: paymentTokenAddress,
      maker: makerAddress
    })
    const buy = orders[0]
    assert.isDefined(buy)
    assert.isDefined(buy.asset)
    if (!buy || !buy.asset) {
      return
    }
    // Make sure it's listed in the past
    assert.isBelow(buy.listingTime.toNumber(), now)
    testFeesMakerOrder(buy, buy.asset.assetContract)

    const sell = orderFromJSON(englishSellOrderJSON)
    assert.equal(+sell.quantity, 1)
    assert.equal(sell.feeRecipient, NULL_ADDRESS)
    assert.equal(sell.paymentToken, paymentTokenAddress)

    /* Requirements in Wyvern contract for funds transfer. */
    assert.isAtMost(buy.takerRelayerFee.toNumber(), sell.takerRelayerFee.toNumber())
    assert.isAtMost(buy.takerProtocolFee.toNumber(), sell.takerProtocolFee.toNumber())
    const sellPrice = await rinkebyClient.getCurrentPrice(sell)
github AugurProject / augur / test / assertions / filters.js View on Github external
var tags = filters[0];

	assert.isDefined(filters, `filters isn't defined`);
	assert.isArray(filters, `filters isn't an array`);
	assert.equal(filters.length, 1, `filters array isn't the expected length`);
	assert.isObject(tags, `filters[0] isn't an object`);

	// Tags object tests
	assert.isDefined(tags, `filters[0] isn't defined`);
	assert.isObject(tags, `filters[0] isn't an object`);
	assert.isDefined(tags.title, `filters[0].title isn't defined`);
	assert.isString(tags.title, `filters[0].title isn't a string`);
	assert.equal(tags.title, 'Tags', `filters[0].title should equal 'Status'`);
	assert.isDefined(tags.options, `filters[0].options isn't defined`);
	assert.isArray(tags.options, `filters[0].options isn't an array`);
	assert.isDefined(tags.options[0], `filters[0].options[0] isn't defined`);
	assert.isObject(tags.options[0], `filters[0].options[0] isn't an object`);

	// Tags Options Tests
	assert.isDefined(tags.options[0], `[0].options[0] isn't defined`);
	assert.isObject(tags.options[0], `[0].options[0] isn't a object`);
	assert.isDefined(tags.options[0].name, `[0].options[0].name isn't defined`);
	assert.isString(tags.options[0].name, `[0].options[0].name isn't a string`);
	assert.isDefined(tags.options[0].value, `[0].options[0].value isn't defined`);
	assert.isString(tags.options[0].value, `[0].options[0].value isn't a string`);
	assert.isDefined(tags.options[0].numMatched, `[0].options[0].numMatched isn't defined`);
	assert.isNumber(tags.options[0].numMatched, `[0].options[0].numMatched isn't a number`);
	assert.isDefined(tags.options[0].isSelected, `[0].options[0].isSelected isn't defined`);
	assert.isBoolean(tags.options[0].isSelected, `[0].options[0].isSelected isn't a boolean`);
	assert.isDefined(tags.options[0].onClick, `[0].options[0].onClick isn't defined`);
	assert.isFunction(tags.options[0].onClick, `[0].options[0].onClick isn't a function`);
}
github stormpath / stormpath-widget / test / data / user / client-api-user-service.js View on Github external
it('should remove account stores that dont have an authorize uri', () => {
      assert.equal(result.accountStores.length, 1);
      assert.isDefined(result.accountStores[0].authorizeUri);
    });
github pubfood / pubfood / test / provider / bidprovider.js View on Github external
it('should not reference optional refresh delegate if not defined', function() {

    var BID_PROVIDER_NO_REFRESH = {
      name: 'no-refresh',
      libUri: 'the Uri',
      init: function(slots, pushBid, done) {}
    };

    var bp = BidProvider.withDelegate(BID_PROVIDER_NO_REFRESH);
    assert.isDefined(bp.refresh);
    assert.isDefined(bp.bidDelegate);

    bp.refresh();
    var log = logger.history[logger.history.length - 1];
    assert.match(log.event.data, /^BidProvider.bidDelegate.refresh/, 'should get bidDelegate warning');

    var BID_PROVIDER_WITH_REFRESH = {
      name: 'no-refresh',
      libUri: 'the Uri',
      init: function() {},
      refresh: function() { testRefresh = true; }
    };

    var testRefresh = false;
    var bp2 = BidProvider.withDelegate(BID_PROVIDER_WITH_REFRESH);
    bp2.refresh();
github webex / react-widgets / test / journeys / lib / test-helpers / space-widget / messaging.js View on Github external
const messageEventTest = (sender, receiver) => {
  const message = 'God, I liked him better before he died.';

  clearEventLog(receiver.browser);
  sendMessage(sender, receiver, message);
  verifyMessageReceipt(receiver, sender, message);
  const events = getEventLog(receiver.browser);
  const eventCreated = events.find((event) => event.eventName === 'messages:created');
  const eventUnread = events.find((event) => event.eventName === 'rooms:unread');

  assert.isDefined(eventCreated, 'has a message created event');
  assert.containsAllKeys(eventCreated.detail, ['resource', 'event', 'actorId', 'data']);
  assert.containsAllKeys(eventCreated.detail.data, ['actorId', 'actorName', 'id', 'personId', 'roomId', 'roomType', 'text']);
  assert.equal(eventCreated.detail.actorId, constructHydraId('PEOPLE', sender.user.id));
  assert.equal(eventCreated.detail.data.actorName, sender.user.displayName);

  assert.isDefined(eventUnread, 'has an unread message event');
  assert.containsAllKeys(eventUnread.detail, ['resource', 'event', 'data']);
  assert.containsAllKeys(eventUnread.detail.data, ['actorId', 'actorName', 'id', 'title', 'type', 'created', 'lastActivity']);
  assert.equal(eventCreated.detail.actorId, constructHydraId('PEOPLE', sender.user.id));
  assert.equal(eventCreated.detail.data.actorName, sender.user.displayName);
};
github microsoftgraph / msgraph-sdk-javascript / spec / development / workload / insights.ts View on Github external
it("Fetch a list of people", async () => {
		try {
			const res = await client.api("/me/people").get();
			const person = res.value[0] as Person;
			assert.isDefined(person.displayName);
			assert.isDefined(person.surname);
			assert.isDefined(person.id);
			assert.isUndefined(person["random fake property that should be null"]);
		} catch (error) {
			throw error;
		}
	});
github microsoftgraph / msgraph-sdk-javascript / spec / types / miscellaneous.ts View on Github external
return getClient().api("/me/mailfolders/inbox").get((err, res) => {
            assert.isTrue(err === null);
            assert.isDefined(res['@odata.context']);
            assert.isDefined(res['id']);
            assert.isDefined(res['displayName']);
            assert.isDefined(res['parentFolderId']);
            assert.isDefined(res['childFolderCount']);
            assert.isDefined(res['unreadItemCount']);
            assert.isDefined(res['totalItemCount']);
            done();
        });
    });