How to use the chai.assert.property 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 twosigma / git-meta / node / lib / util / shorthand_parser_util.js View on Github external
Object.keys(rawRepo.refs).forEach(name => {
        const override = rawRepo.refs[name];
        if (null !== override) {
            resultArgs.refs[name] = override;
        }
        else {
            delete resultArgs.refs[name];
        }
    });

    // If we have a current branch, make sure it's valid and update HEAD where
    // necessary.

    if (null !== resultArgs.currentBranchName) {
        assert.property(resultArgs.branches, resultArgs.currentBranchName);

        // If the head is 'null', the repo is bare and we don't need to reset
        // it.  If it is not 'null', then we should make it point to the same
        // commit as the current branch.

        if (null !== resultArgs.head) {
            resultArgs.head =
                         resultArgs.branches[resultArgs.currentBranchName].sha;
        }
    }

    // Copy in new commits.

    Object.assign(resultArgs.commits, rawRepo.commits);

    // Copy the notes
github davidkpiano / react-redux-form / test / form-reducer-spec.js View on Github external
it('should create the fields only when interacted with', () => {
      const action = actions.setTouched('test.foo');
      const touchedState = reducer(undefined, action);

      assert.property(touchedState, 'foo');
      assert.isTrue(touchedState.foo.touched);
      assert.notProperty(touchedState, 'bar');
      assert.notProperty(touchedState, 'baz');
    });
github ClaudioAlbertin / brainjs / test / utils.js View on Github external
it('should return an object with correct structure', function () {
      assert.isObject(scale, 'return value is object');
      assert.property(scale, 'min', 'object contains minimum');
      assert.property(scale, 'max', 'object contains maximum');
      assert.property(scale, 'abs', 'object contains absolute');
      assert.property(scale, 'avg', 'object contains average');
    });
github archiverjs / node-archiver / test / archiver.js View on Github external
it('should append filepath', function() {
        assert.property(entries, 'test.txt');
        assert.propertyVal(entries['test.txt'], 'name', 'test.txt');
        assert.propertyVal(entries['test.txt'], 'date', '2013-01-03T14:26:38.000Z');
        assert.propertyVal(entries['test.txt'], 'crc32', 585446183);
        assert.propertyVal(entries['test.txt'], 'size', 19);
      });
github jakearchibald / idb / test / main.ts View on Github external
test('getFromIndex', async () => {
    const schemaDB = await openDBWithData();
    db = schemaDB as IDBPDatabase;

    assert.property(schemaDB, 'getFromIndex', 'Method exists');
    const val = await schemaDB.getFromIndex(
      'object-store',
      'title',
      'Article 1',
    );

    typeAssert>(true);

    assert.deepStrictEqual(
      val,
      {
        id: 1,
        title: 'Article 1',
        date: new Date('2019-01-04'),
      },
      'Correct value from store',
github javascript-obfuscator / javascript-obfuscator / test / functional-tests / cli / JavaScriptObfuscatorCLI.spec.ts View on Github external
it('source map from created file should contains property `names`', () => {
                        assert.property(sourceMapObject, 'names');
                    });
github ethereumjs / ethrpc / test / rpc.js View on Github external
var asserts = function (t, block) {
            assert.property(block, "number");
            assert.property(block, "parentHash");
            assert.property(block, "hash");
            assert.property(block, "nonce");
            assert.property(block, "sha3Uncles");
            assert.property(block, "logsBloom");
            assert.property(block, "transactionsRoot");
            assert.property(block, "stateRoot");
            assert.property(block, "miner");
            assert.property(block, "difficulty");
            assert.property(block, "totalDifficulty");
            assert.property(block, "size");
            assert.property(block, "extraData");
            assert.property(block, "gasLimit");
            assert.property(block, "gasUsed");
            assert.property(block, "timestamp");
            assert.property(block, "transactions");
            assert.property(block, "uncles");
            assert.isAbove(parseInt(block.number), 0);
            assert.isAbove(parseInt(block.hash), 0);
            assert.isAbove(parseInt(block.parentHash), 0);
            assert.isAbove(parseInt(block.nonce), 0);
            assert.isAbove(parseInt(block.sha3Uncles), 0);
            assert.isAbove(parseInt(block.transactionsRoot), 0);
            assert.isAbove(parseInt(block.stateRoot), 0);
            assert.isAbove(parseInt(block.miner), 0);
            assert.isAbove(parseInt(block.difficulty), 0);
github ethereumjs / ethrpc / test / rpc.js View on Github external
var asserts = function (t, block) {
        assert.property(block, "number");
        assert.property(block, "parentHash");
        assert.property(block, "hash");
        assert.property(block, "nonce");
        assert.property(block, "sha3Uncles");
        assert.property(block, "logsBloom");
        assert.property(block, "transactionsRoot");
        assert.property(block, "stateRoot");
        assert.property(block, "miner");
        assert.property(block, "difficulty");
        assert.property(block, "totalDifficulty");
        assert.property(block, "size");
        assert.property(block, "extraData");
        assert.property(block, "gasLimit");
        assert.property(block, "gasUsed");
        assert.property(block, "timestamp");
        assert.property(block, "transactions");
        assert.property(block, "uncles");
        assert.isAbove(parseInt(block.number), 0);
        assert.isAbove(parseInt(block.hash), 0);
        assert.isAbove(parseInt(block.parentHash), 0);
        assert.isAbove(parseInt(block.nonce), 0);
        assert.isAbove(parseInt(block.sha3Uncles), 0);
        assert.isAbove(parseInt(block.transactionsRoot), 0);
        assert.isAbove(parseInt(block.stateRoot), 0);
        assert.isAbove(parseInt(block.miner), 0);
        assert.isAbove(parseInt(block.difficulty), 0);
        assert.isAbove(parseInt(block.totalDifficulty), 0);
        assert.isAbove(parseInt(block.gasLimit), 0);
        assert.isAbove(parseInt(block.timestamp), 0);
        assert.isAbove(parseInt(block.number), 0);
github azuqua / jwt-redis-session / test / tests.js View on Github external
req.session.reload(function(err){
						assert.notOk(err, "No error when reloading session");
						assert.property(req.session, "foo", "Session has new foo property");
						res.json(req.session.toJSON());
					});
				});
github ethereumjs / ethrpc / test / ipc.js View on Github external
var asserts = function (t, block) {
      assert.property(block, "number");
      assert.property(block, "parentHash");
      assert.property(block, "hash");
      assert.property(block, "nonce");
      assert.property(block, "sha3Uncles");
      assert.property(block, "logsBloom");
      assert.property(block, "transactionsRoot");
      assert.property(block, "stateRoot");
      assert.property(block, "miner");
      assert.property(block, "difficulty");
      assert.property(block, "totalDifficulty");
      assert.property(block, "size");
      assert.property(block, "extraData");
      assert.property(block, "gasLimit");
      assert.property(block, "gasUsed");
      assert.property(block, "timestamp");
      assert.property(block, "transactions");
      assert.property(block, "uncles");
      assert.isAbove(parseInt(block.number), 0);
      assert.isAbove(parseInt(block.hash), 0);
      assert.isAbove(parseInt(block.parentHash), 0);
      assert.isAbove(parseInt(block.nonce), 0);
      assert.isAbove(parseInt(block.sha3Uncles), 0);
      assert.isAbove(parseInt(block.transactionsRoot), 0);