当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript assert.instanceOf方法代码示例

本文整理汇总了TypeScript中chai.assert.instanceOf方法的典型用法代码示例。如果您正苦于以下问题:TypeScript assert.instanceOf方法的具体用法?TypeScript assert.instanceOf怎么用?TypeScript assert.instanceOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在chai.assert的用法示例。


在下文中一共展示了assert.instanceOf方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

  it('should get metadata for provided target', () => {
    let metaData = MetaData.forTarget(Product);

    assert.isTrue(MetaData['metaMap'].has(Product));
    assert.instanceOf(metaData, Homefront);
    assert.instanceOf(metaData.fetch('mapping'), Mapping);
  });
开发者ID:RWOverdijk,项目名称:wetland,代码行数:7,代码来源:MetaData.spec.ts

示例2: done

 () => {
   assert.equal(state[uiKey1].state, uidata.UIDataState.LOAD_ERROR);
   assert.equal(state[uiKey2].state, uidata.UIDataState.LOAD_ERROR);
   assert.instanceOf(state[uiKey1].error, Error);
   assert.instanceOf(state[uiKey2].error, Error);
   done();
 },
开发者ID:Yogendrovich,项目名称:cockroach,代码行数:7,代码来源:uiData.spec.ts

示例3: assertTransport

export function assertTransport(transport: IMonitor) {
  assertNotEmptyString(transport.id);
  assertNotEmptyString(transport.line);
  assertNotEmptyString(transport.direction);

  assert.isNumber(transport.arrivalTimeRelative);
  assert.isNumber(transport.scheduledTimeRelative);
  assert.isNumber(transport.delayTime);

  assert.instanceOf(transport.arrivalTime, Date);
  assert.instanceOf(transport.scheduledTime, Date);

  assert.property(transport, "state");

  assertMode(transport.mode);

  if (transport.line && transport.line.indexOf("E") === -1) {
    assertDiva(transport.diva!);
  } else {
    assert.isUndefined(transport.diva);
  }

  assert.isDefined(transport.platform);
  assertPlatform(transport.platform!);
}
开发者ID:kiliankoe,项目名称:dvbjs,代码行数:25,代码来源:helper.ts

示例4: it

  it('timeout', async function () {
    let job = new Job();

    job.setValue('a', {
      'v1': 1,
      'v2': 2
    });

    let bBlock = job.createBlock('b');

    bBlock._load({
      '#is': 'map',
      '~input': '##.a',
      'src': {
        '#is': {
          '#is': '',
          '#wait': true
        }
      }
    });

    // without timeout, block would never have output
    await shouldTimeout(bBlock.waitNextValue('output'), 10);

    bBlock.setValue('timeout', 0.01);

    let output = await bBlock.waitNextValue('output');

    assert.instanceOf(output.v1, ErrorEvent, 'value is timeout error');
    assert.instanceOf(output.v2, ErrorEvent, 'value is timeout error');

    // delete job;
    job.deleteValue('b');
  });
开发者ID:breezeflow,项目名称:breezeflow,代码行数:34,代码来源:MapFunction.spec.ts

示例5:

				return cache.getObject(request).then((obj:xm.http.CacheObject) => {
					assert.instanceOf(obj, xm.http.CacheObject, 'obj');
					assert.ok(obj.info);

					assert.notOk(obj.response, 'obj.response');

					assert.instanceOf(obj.body, Buffer, 'obj.body');
					assert.strictEqual(obj.body.toString('utf8'), expected, 'content');
				});
开发者ID:HansS,项目名称:tsd,代码行数:9,代码来源:HTTPCache.ts

示例6: assertStop

export function assertStop(stop: IStop) {
  assertLocation(stop);

  assert.instanceOf(stop.arrival, Date);
  assert.instanceOf(stop.departure, Date);

  if (stop.platform) {
    // workaround for station without platform
    // eg LennĂŠplatz
    assertPlatform(stop.platform);
  }

  assert.strictEqual(stop.type, POI_TYPE.Stop);
}
开发者ID:kiliankoe,项目名称:dvbjs,代码行数:14,代码来源:helper.ts

示例7: test

 test('rejects when Github returns a 404 response status code', async () => {
   const mockRequestApi = () => {
     const readStream = new PassThrough();
     setTimeout(() => {
       readStream.emit('response', {
         statusCode: 404,
         statusMessage: 'TEST MESSAGE - 404',
       });
     }, 10);
     return readStream;
   };
   const github = new Github({
     owner: 'TEST_OWNER',
     repo: 'TEST_REPO',
     // tslint:disable-next-line: no-any
     requestApi: mockRequestApi as any,
   });
   const tmpDir = temp.mkdirSync();
   const err = await invertPromise(
       github.extractReleaseTarball('http://foo.com/bar.tar', tmpDir));
   assert.instanceOf(err, GithubResponseError);
   assert.equal(
       err!.message,
       '404 fetching http://foo.com/bar.tar - TEST MESSAGE - 404');
 });
开发者ID:poehlmann,项目名称:EvaluacionDiferencialDeLaMemoria,代码行数:25,代码来源:github_test.ts

示例8: it

  it('basic', function () {
    TestFunctionRunner.clearLog();
    let job = new Job();

    let aBlock = job.createBlock('a');

    aBlock.setValue('#is', 'WorkerFunction:class1');

    let jobData: DataMap = {
      '#is': '',
      'runner': {'#is': 'test-runner', '#-log': 'nest1', '~#call': '##.#input.in1'}
    };
    WorkerFunction.registerType(jobData, {name: 'class1'}, 'WorkerFunction');

    Root.run();
    assert.deepEqual(TestFunctionRunner.popLogs(), ['nest1'],
      'nested job should be created');

    let impl: Job = aBlock.getValue('#func')  as Job;
    assert.instanceOf(impl, Job, 'get #func of nested job');

    assert.deepEqual(impl.save(), jobData, 'serialize nested job');

    aBlock.setValue('in1', 1);
    Root.run();
    assert.deepEqual(TestFunctionRunner.popLogs(), ['nest1'],
      'nested job triggered with binding');

    aBlock.setValue('in1', 2);
    aBlock.setValue('#is', null);
    Root.run();
    assert.isEmpty(TestFunctionRunner.logs, 'nested job destroy');

    assert.deepEqual(impl.save(), jobData, 'serialize nested job after destroy');
  });
开发者ID:breezeflow,项目名称:breezeflow,代码行数:35,代码来源:WorkerFunction.spec.ts

示例9:

				return repo.api.getBlob(blobSha).then((apiData) => {
					assert.ok(apiData, 'api data');
					assert.isObject(apiData, 'api data');

					var apiBuffer = git.GitUtil.decodeBlobJson(apiData);
					assert.instanceOf(apiBuffer, Buffer, 'api buffer');

					var apiSha = git.GitUtil.blobShaHex(apiBuffer);
					helper.assertFormatSHA1(apiSha, 'sha');

					assert.strictEqual(rawSha, blobSha, 'rawSha vs blobSha');
					assert.strictEqual(apiSha, rawSha, 'apiSha vs rawSha');

					// this explodes.. weird!
					// assert.strictEqual(apiBuffer, rawBuffer, 'api vs raw buffer');

					// temp hackish
					return xm.file.mkdirCheckQ(gitTest.extraDir, true).then(() => {
						return FS.write(path.join(gitTest.extraDir, 'tmp_test.bin'), rawData, {flags:'wb'});
					}).then(() => {
						return FS.read(path.join(gitTest.extraDir, 'tmp_test.bin'), {flags:'rb'});
					}, (err) => {
						xm.log.error('storage test failure');
						throw err;
					}).then((cycleData:NodeBuffer) => {
						assert.ok(rawData, 'raw data');
						assert.instanceOf(rawData, Buffer, 'raw data');

						var cycleSha = git.GitUtil.blobShaHex(cycleData);
						assert.strictEqual(cycleSha, rawSha, 'cycleSha vs rawData');
						assert.strictEqual(cycleSha, blobSha, 'cycleSha vs blobSha');
						assert.strictEqual(cycleSha, apiSha, 'cycleSha vs apiSha');
					});
				});
开发者ID:AbraaoAlves,项目名称:tsd,代码行数:34,代码来源:Github.ts

示例10: isBaseError

export function isBaseError(error: any, baseErrorType: IBaseErrorType): void {
	chai.assert.isObject(error);

	chai.assert.instanceOf(error, BaseError);
	chai.assert.equal(error.errno, baseErrorType.errno);
	chai.assert.equal(error.message, baseErrorType.message);
}
开发者ID:iskilber,项目名称:iska,代码行数:7,代码来源:asserts.ts


注:本文中的chai.assert.instanceOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。