本文整理汇总了TypeScript中chai.assert.isNotNull方法的典型用法代码示例。如果您正苦于以下问题:TypeScript assert.isNotNull方法的具体用法?TypeScript assert.isNotNull怎么用?TypeScript assert.isNotNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chai.assert
的用法示例。
在下文中一共展示了assert.isNotNull方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("should verify BuildService.GetBuildDefinitions", async function() {
this.timeout(TestSettings.TestTimeout); //http://mochajs.org/#timeouts
const ctx: TeamServerContext = Mocks.TeamServerContext(TestSettings.RemoteRepositoryUrl);
ctx.CredentialHandler = CredentialManager.GetCredentialHandler();
ctx.RepoInfo = Mocks.RepositoryInfo();
ctx.UserInfo = undefined;
const svc: BuildService = new BuildService(ctx);
const definitions = await svc.GetBuildDefinitions(TestSettings.TeamProject);
assert.isNotNull(definitions, "definitions was null when it shouldn't have been");
//console.log(definitions.length);
expect(definitions.length).to.be.at.least(1);
});
示例2: it
it("should verify WorkItemTrackingService.CreateWorkItem", async function() {
this.timeout(TestSettings.TestTimeout); //http://mochajs.org/#timeouts
const ctx: TeamServerContext = Mocks.TeamServerContext(TestSettings.RemoteRepositoryUrl);
ctx.CredentialHandler = CredentialManager.GetCredentialHandler();
ctx.RepoInfo = Mocks.RepositoryInfo();
ctx.UserInfo = undefined;
const itemType : string = "Bug";
const today: Date = new Date();
const title: string = "Work item created by integration test (" + today.toLocaleString() + ")";
const svc: WorkItemTrackingService = new WorkItemTrackingService(ctx);
const item: WorkItem = await svc.CreateWorkItem(ctx, itemType, title);
assert.isNotNull(item, "item was null when it shouldn't have been");
});
示例3: it
it('works with Map<X,Object>', () => {
let map = new Map<string, Thing>();
map.set('1', new Thing(1, '1'));
let storePath = path.join(process.cwd(), 'x.db');
encoder.serializeToFileSync(storePath, map);
let other = encoder.deserializeFromFileSync(storePath);
let found: Thing = null;
for (let thing of map.values()) {
if (thing.xname == '1') {
found = thing;
break;;
}
}
let type = typeof found;
assert.isTrue('object' == type)
assert.isNotNull(found);
//WRONG they are both MAPs not Objects
assert.deepEqual(map, other);
})
示例4: it
it("gives the correct regression equation, R^2, and function for a sample input with strong correlation", ()=>{
const data:[number,number][] = [
[0,0.33517481],
[1,3.00712561],
[2,6.73118302],
[3,9.25128682],
[4,12.0432596],
[5,15.9087018],
[6,18.71122156],
[7,21.69213527],
[8,24.57708193],
[9,27.98002031],
[10,30.67017471],
[11,33.55231386],
[12,36.20724938],
[13,39.21414698],
[14,42.74163248],
[15,45.95986539],
[16,48.28399276],
[17,51.52361803],
[18,54.62495359]
];
const computations = getRegressionComputations(data);
// target values computed via python: scipy.stats.linregress
const m = 3.0120636256561446;
const b = 0.41853989070105158;
const r2 = 0.99970735279778178;
// test regression equation to make sure its approximately the same as what python gives
const match = computations.string.match(/y = ([\d.]+)x \+ ([\d.]+)/);
assert.isNotNull(match, "equation has correct form");
const M = parseFloat(match![1]);
const B = parseFloat(match![2]);
assert.approximately(M, m, 0.05);
assert.approximately(B, b, 0.05);
// make sure `predict` gives the same result as the equation
for (let i=0; i<100; i+=1) {
assert.approximately(computations.predict(i)[1], M*i + B, 0.0000005, `value for ${i}`);
}
// test R^2
assert.approximately(computations.r2, r2, 0.05, "R^2");
});
示例5: it
it('should return appropriate step constraint', () => {
const api = createApi();
const obj = {foo: 1};
const bapi = api.addInput(obj, 'foo', {
step: 1,
});
const iv = bapi.controller.controller.value;
assert.instanceOf(iv, InputValue);
if (!(iv instanceof InputValue)) {
throw new Error('Input value is empty');
}
const c: Constraint<unknown> | null = TypeUtil.forceCast(iv.constraint);
if (!c) {
throw new Error('Constraint is empty');
}
assert.isNotNull(ConstraintUtil.findConstraint(c, StepConstraint));
});
示例6: it
it('should return error for invalid specs', function() {
assert.isNotNull(getEncodingMappingError({
mark: LINE,
encoding: {
x: {field: 'b'} // missing y
}
}));
assert.isNotNull(getEncodingMappingError({
mark: AREA,
encoding: {
y: {field: 'b'} // missing x
}
}));
assert.isNotNull(getEncodingMappingError({
mark: TEXT,
encoding: {
y: {field: 'b'} // missing text
}
}));
assert.isNotNull(getEncodingMappingError({
mark: LINE,
encoding: {
shape: {field: 'b'} // using shape with line
}
}));
assert.isNotNull(getEncodingMappingError({
mark: AREA,
encoding: {
shape: {field: 'b'} // using shape with area
}
}));
assert.isNotNull(getEncodingMappingError({
mark: BAR,
encoding: {
shape: {field: 'b'} // using shape with bar
}
}));
});
示例7: done
todo.save<AV.Object>().then((todo)=>{
// 保存成功,可以打开控制台核对修改结果
chai.assert.isNotNull(todo.get('title'));
done();
},(error)=>{
示例8: execCli
execCli(["-c", "./test/config/tslint-custom-rules.json", "-r", "./someRandomDir", "src/test.ts"], (err) => {
assert.isNotNull(err, "process should exit with error");
assert.strictEqual(err.code, 1, "error code should be 1");
done();
});
示例9:
.then((work: Work) => {
assert.isNotNull(work.result);
assert.equal(work.result.result, 3);
assert.lengthOf(work.childrenIDs, 1);
assert.lengthOf(work.finishedChildrenIDs, 1);
});