How to use the chai.assert.lengthOf 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 keymanapp / keyman / common / predictive-text / unit_tests / headless / promise-store.js View on Github external
it("should track a promise's callbacks", function () {
      var promises = new PromiseStore();
      // There should be no tracked promises.
      assert.lengthOf(promises, 0);

      // Add one promise.
      new Promise(function (resolve, reject) {
        promises.make(randomToken(), resolve, reject);
      });
      assert.lengthOf(promises, 1);
    });
github joiful-ts / joiful / test / unit / inheritance.ts View on Github external
it(`Child validations do not apply when validating the parent class`, function () {
        class ParentClass {
            @Min(10)
            foo! : number;
        }
        class ChildClass extends ParentClass {
            @Min(10)
            bar! : number;
        }

        const instance = new ParentClass();
        const result = isInvalid(validator, instance);
        assert.lengthOf(result.error.details, 1);
    });
github bids-standard / bids-validator / bids-validator / utils / files / __tests__ / remoteFiles.spec.js View on Github external
it('properly parses a git-annex remote metadata file', () => {
      const resp = 'timestamp remoteuuid:commitinfo xversionId#fileName'
      const remotesInfo = remoteFiles.processRemoteMetadata(resp)
      assert.lengthOf(remotesInfo, 1)
      const remoteObj = remotesInfo[0]
      expect(remoteObj).toHaveProperty('timestamp')
      expect(remoteObj.timestamp).toEqual('timestamp')
      expect(remoteObj).toHaveProperty('remoteUuid')
      expect(remoteObj.remoteUuid).toEqual('remoteuuid')
      expect(remoteObj).toHaveProperty('fileName')
      expect(remoteObj.fileName).toEqual('fileName')
      expect(remoteObj).toHaveProperty('versionId')
      expect(remoteObj.versionId).toEqual('versionId')
    })
    it('returns an empty array if there is an improperly formatted metadata file', () => {
github mozilla / fxa-auth-server / test / local / email / notifications.js View on Github external
let args = log.info.args[0];
      assert.lengthOf(args, 2);
      assert.equal(args[0], 'emailEvent');
      assert.deepEqual(args[1], {
        complaint: true,
        domain: 'other',
        flow_id: 'wibble',
        locale: 'fr',
        template: 'blee',
        templateVersion: '',
        type: 'bounced'
      });

      args = log.info.args[1];
      assert.lengthOf(args, 2);
      assert.equal(args[0], 'emailEvent');
      assert.deepEqual(args[1], {
        complaint: true,
        domain: 'gmail.com',
        flow_id: 'wibble',
        locale: 'fr',
        template: 'blee',
        templateVersion: '',
        type: 'bounced'
      });
    });
github marcog83 / RoboJS / test / DomWatcher.spec.js View on Github external
watcher.onAdded.connect(nodes=>{
            assert.equal(div1,nodes[0]);
            assert.equal(div2,nodes[1]);
            assert.lengthOf(nodes,2);
        });
        watcher.onRemoved.connect(nodes=>{
github ostdotcom / ost-view / test / block_fetcher_tests.js View on Github external
.then(function(resArray){
        assert.typeOf(resArray, 'array');
        assert.lengthOf(resArray, 2);

        return new BlockKlass(testChainId).select('COUNT(id)').fire();
      })
      .then(function(res){
github 1ven / do / test / server / db / index.spec.js View on Github external
        .then(result => assert.lengthOf(result, 0));
    });
github advanced-rest-client / arc-electron / scripts / packages / context-actions / spec / context-menu.renderer.spec.js View on Github external
it('Renders all actions', () => {
      instance.renderActions(getActions(), pos);
      const nodes = document.body.querySelectorAll('paper-listbox paper-item');
      assert.lengthOf(nodes, 2);
    });
github cockroachdb / cockroach-gen / pkg / ui / src / redux / localities.spec.ts View on Github external
const tree = selectLocalityTree(state);

    assert.isEmpty(tree.tiers);
    assert.isEmpty(tree.nodes);

    assert.hasAllKeys(tree.localities, ["region"]);
    const regions = tree.localities.region;

    assert.hasAllKeys(regions, ["us-east-1", "us-east-2"]);

    const usEast1 = regions["us-east-1"];

    assert.isEmpty(usEast1.localities);
    assert.deepEqual(usEast1.tiers, [{ key: "region", value: "us-east-1" }]);

    assert.lengthOf(usEast1.nodes, 1);

    const usEast2 = regions["us-east-2"];

    assert.isEmpty(usEast2.localities);
    assert.deepEqual(usEast2.tiers, [{ key: "region", value: "us-east-2" }]);

    assert.lengthOf(usEast2.nodes, 1);
  });
});
github cockroachdb / cockroach-gen / pkg / ui / src / util / api.spec.ts View on Github external
.then((result) => {
          assert.lengthOf(
            fetchMock.calls(`${api.API_PREFIX}/databases/${dbName}`),
            1,
          );
          assert.lengthOf(result.table_names, 2);
          assert.lengthOf(result.grants, 2);
        });
    });