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


TypeScript assert.isNull方法代码示例

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


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

示例1: it

  it("IsUsable", () => {
    let ia = new IfAddrs();
    ia.addAddr(IPAddress.parse("10.1.0.1/24"));
    assert.isNotNull(ia.addAddr(IPAddress.parse("10.2.0.1/24")), "ia.addAddr failed");
    assert.isNull(ia.addAddr(IPAddress.parse("256.2.0.1/24")), "ia.addAddr failed");
    assert.isNotNull(ia.addRoute(RouteVia.parse(IPAddress.parse("172.16.0.1/24"), 
      IPAddress.parse("172.16.0.254"))));

    assert.isNull(ia.addDest(IPAddress.parse("172.316.0.1/24")));
    assert.isNotNull(ia.addDest(IPAddress.parse("172.16.0.1/24"))); 

    assert.isNotNull(ia.addRoute(RouteVia.parse(IPAddress.parse("172.17.0.1/24"), 
      IPAddress.parse("172.17.0.254"))), "ia.addRoute 1 failed");
    assert.isNull(ia.addRoute(RouteVia.parse(IPAddress.parse("300.17.0.1/24"), 
      IPAddress.parse("172.17.0.254"))), "ia.addRoute 2 failed");
    assert.isNull(ia.addRoute(RouteVia.parse(IPAddress.parse("300.17.0.1/24"), 
      IPAddress.parse("172.17.0.254/23"))), "ia.addRoute 3 failed"); 
    assert.isNull(ia.addRoute(RouteVia.parse(IPAddress.parse("300.17.0.1/24"), 
      IPAddress.parse("172.17.0.354"))), "ia.addRoute 4 failed");
    let ret = ia.asCommands("DEV");
    let ref = ["ip addr add 10.1.0.1/24 dev DEV",
               "ip addr add 10.2.0.1/24 dev DEV",
               "ip route add 172.16.0.1/24 via 172.16.0.254 dev DEV",
               "ip route add 172.17.0.1/24 via 172.17.0.254 dev DEV",
               "ip link set dev DEV mtu 1360 up"].join("\n");
    assert.equal(ret, ref, "wrong string");           
    let objIa = JSON.stringify(ia.asJson());
    let other = JSON.parse(objIa);
    let otherIa = IfAddrs.fromJson(other);
    // console.log("other:", other);
    // console.log("otherIa:", otherIa);
    assert.equal(objIa, JSON.stringify(otherIa.asJson()));
  });
开发者ID:mabels,项目名称:posco,代码行数:33,代码来源:if_addrs-test.ts

示例2: it

    it('should return null if any encoding property is a wildcard', () => {
      let specQ: SpecQuery = {
        mark: 'bar',
        encodings: [
          {channel: '?', field: 'Q', type: Type.QUANTITATIVE},
          {channel: Channel.Y, field: 'N', type: Type.NOMINAL},
          {channel: Channel.COLOR, field: 'N1', type: Type.NOMINAL},
        ],
      };
      assert.isNull(getVlStack(specQ));

      specQ = {
        mark: 'bar',
        encodings: [
          {channel: Channel.X, field: 'Q', type: Type.QUANTITATIVE},
          {channel: Channel.Y, field: '?', type: Type.NOMINAL},
          {channel: Channel.COLOR, field: 'N1', type: Type.NOMINAL},
        ],
      };
      assert.isNull(getVlStack(specQ));

      specQ = {
        mark: 'bar',
        encodings: [
          {channel: Channel.X, field: 'Q', type: Type.QUANTITATIVE},
          {channel: Channel.Y, field: 'N', type: Type.NOMINAL},
          {channel: Channel.COLOR, field: 'N1', type: '?'},
        ],
      };
      assert.isNull(getVlStack(specQ));
    });
开发者ID:uwdata,项目名称:compassql,代码行数:31,代码来源:spec.test.ts

示例3:

 return Promise.all([p, p2]).then(() => {
   assert.lengthOf(fetchMock.calls(`${api.API_PREFIX}/uidata`), 1);
   assert.lengthOf(_.keys(state), 2);
   assert.equal(state[uiKey1].data, uiObj1);
   assert.equal(state[uiKey2].data, uiObj2);
   assert.isNull(state[uiKey1].error);
   assert.isNull(state[uiKey2].error);
   assert.equal(state[uiKey1].state, uidata.UIDataState.VALID);
   assert.equal(state[uiKey2].state, uidata.UIDataState.VALID);
 });
开发者ID:Yogendrovich,项目名称:cockroach,代码行数:10,代码来源:uiData.spec.ts

示例4: it

 it('delete', async ()=>{
     const data = new Data(/*Memdown*/);
     const users = data.users.async;
     let admin = await users.get('admin').catch(e=> null);        
     assert.isNull(admin);
     await users.put({ name: 'admin'});
     admin = await users.get('admin').catch(e=> null);
     await data.users.async.del(admin);
     admin = await users.get('admin').catch(e=> null);
     assert.isNull(admin);
 })
开发者ID:D10221,项目名称:level-bucket,代码行数:11,代码来源:test.ts

示例5:

 return p.then(() => {
   assert.lengthOf(fetchMock.calls(expectedURL), 1);
   assert.lengthOf(_.keys(state.data), 1);
   assert.deepEqual(state.data[missingKey], undefined);
   assert.isNull(state.error);
   assert.equal(state.inFlight, 0);
 });
开发者ID:CubeLite,项目名称:cockroach,代码行数:7,代码来源:uiData.spec.ts

示例6: it

 it("should correctly dispatch receiveDatabaseList", function () {
   let dbList = { databases: [] as string[] };
   state = reducer(state, databases.receiveDatabaseList(dbList));
   assert.isFalse(state.inFlight);
   assert.isNull(state.lastError);
   assert.deepEqual(state.databaseList, dbList);
 });
开发者ID:binhn,项目名称:cockroach,代码行数:7,代码来源:databases.spec.ts

示例7: it

  it('AVRole#save', function (done) {
    try {
      // 示例代码-Start
      // 新建一个角色,并把为当前用户赋予该角色
      let roleAcl = new AV.ACL();
      roleAcl.setPublicReadAccess(true);
      roleAcl.setPublicWriteAccess(false);

      // 当前用户是该角色的创建者,因此具备对该角色的写权限
      roleAcl.setWriteAccess(AV.User.current(), true);

      administratorRole = new AV.Role(randomRolename, roleAcl);//新建角色
      administratorRole.save<AV.Role>().then((role) => {
        // 创建成功
        chai.assert.isNotNull(role.id);
        done();
      }, error => {
        if (error) throw error;
      });//保存
      // 示例代码-End
    }
    catch (e) {
      chai.assert.isNull(e);
    }
  });
开发者ID:leancloud,项目名称:TypeScript-Sample-Code,代码行数:25,代码来源:AVRole#save.ts

示例8: it

		it("should return the error when some error is thrown", async () => {
			const error = "some error";
			mockData({isVirtualBoxInstalled: true, spawnOutput: { stdout: null, stderr: error }});
			const output = await virtualBoxService.enumerateGuestProperties("testId");
			assert.isNull(output.properties);
			assert.deepEqual(output.error, error);
		});
开发者ID:NativeScript,项目名称:nativescript-cli,代码行数:7,代码来源:virtualbox-service.ts

示例9: debug

 onEnd: ({status, statusMessage, headers, message, trailers}) => {
   DEBUG && debug("status", status, "statusMessage", statusMessage, "headers", headers, "res", message, "trailers", trailers);
   assert.strictEqual(statusMessage, "Response closed without headers");
   assert.strictEqual(status, grpc.Code.Unknown);
   assert.isNull(message);
   done();
 }
开发者ID:mwitkow,项目名称:grpc-browser-compat,代码行数:7,代码来源:unary.spec.ts


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