本文整理汇总了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()));
});
示例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));
});
示例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);
});
示例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);
})
示例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);
});
示例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);
});
示例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);
}
});
示例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);
});
示例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();
}