本文整理汇总了TypeScript中assert.notStrictEqual函数的典型用法代码示例。如果您正苦于以下问题:TypeScript notStrictEqual函数的具体用法?TypeScript notStrictEqual怎么用?TypeScript notStrictEqual使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了notStrictEqual函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: setTimeout
next: (root: Element) => {
const firstElem = root.querySelector('.first') as HTMLElement;
const secondElem = root.querySelector('.second') as HTMLElement;
assert.notStrictEqual(firstElem, null);
assert.notStrictEqual(typeof firstElem, 'undefined');
assert.notStrictEqual(secondElem, null);
assert.notStrictEqual(typeof secondElem, 'undefined');
assert.doesNotThrow(function() {
setTimeout(() => firstElem.click());
setTimeout(() => secondElem.click(), 5);
});
},
示例2: testInsert
async function testInsert(urlshortener: urlshortener_v1.Urlshortener) {
const requestBody = {longUrl: 'http://google.com/'};
nock(Utils.baseUrl)
.post('/resource')
.reply(200);
const res = await urlshortener.url.insert({requestBody});
assert.notStrictEqual(res.data, null);
assert.notStrictEqual(res.data.kind, null);
assert.notStrictEqual(res.data.id, null);
assert.strictEqual(res.data.longUrl, 'http://google.com/');
return res;
}
示例3: setTimeout
next: (elements: Array<Element>) => {
assert.strictEqual(Array.isArray(elements), true);
assert.strictEqual(elements.length, 1);
const correctElement = elements[0];
assert.notStrictEqual(correctElement, null);
assert.notStrictEqual(typeof correctElement, 'undefined');
assert.strictEqual(correctElement.tagName, 'SPAN');
setTimeout(() => {
dispose();
done();
});
},
示例4: setTimeout
next: (elements: Array<Element>) => {
assert.strictEqual(elements.length, 1);
const element = elements[0];
assert.notStrictEqual(element, null);
assert.notStrictEqual(typeof element, 'undefined');
assert.strictEqual(element.tagName, 'H4');
assert.strictEqual(element.textContent, 'Correct');
setTimeout(() => {
dispose();
done();
});
},
示例5: FileWalker
walker.readStdout(cmd1, 'utf8', /*isRipgrep=*/false, (err1, stdout1) => {
assert.equal(err1, null);
assert.notStrictEqual(stdout1.split('\n').indexOf(file0), -1, stdout1);
assert.notStrictEqual(stdout1.split('\n').indexOf(file1), -1, stdout1);
const walker = new FileWalker({ folderQueries: ROOT_FOLDER_QUERY, excludePattern: { 'examples/subfolder': true } });
const cmd2 = walker.spawnFindCmd(TEST_ROOT_FOLDER);
walker.readStdout(cmd2, 'utf8', /*isRipgrep=*/false, (err2, stdout2) => {
assert.equal(err2, null);
assert.notStrictEqual(stdout1.split('\n').indexOf(file0), -1, stdout1);
assert.strictEqual(stdout2.split('\n').indexOf(file1), -1, stdout2);
done();
});
});
示例6: FileWalker
walker.readStdout(cmd1, 'utf8', (err1, stdout1) => {
assert.equal(err1, null);
assert.notStrictEqual(stdout1!.split('\n').indexOf(file0), -1, stdout1);
assert.notStrictEqual(stdout1!.split('\n').indexOf(file1), -1, stdout1);
const walker = new FileWalker({ type: QueryType.File, folderQueries: ROOT_FOLDER_QUERY, excludePattern: { '**/subfolder/anotherfolder': true } });
const cmd2 = walker.spawnFindCmd(TEST_ROOT_FOLDER);
walker.readStdout(cmd2, 'utf8', (err2, stdout2) => {
assert.equal(err2, null);
assert.notStrictEqual(stdout1!.split('\n').indexOf(file0), -1, stdout1);
assert.strictEqual(stdout2!.split('\n').indexOf(file1), -1, stdout2);
done();
});
});
示例7: setTimeout
next: (root: Element) => {
const wrongElement = root.querySelector('.bar') as HTMLElement;
const correctElement = root.querySelector('.foo .bar') as HTMLElement;
assert.notStrictEqual(wrongElement, null);
assert.notStrictEqual(correctElement, null);
assert.notStrictEqual(typeof wrongElement, 'undefined');
assert.notStrictEqual(typeof correctElement, 'undefined');
assert.strictEqual(wrongElement.tagName, 'H2');
assert.strictEqual(correctElement.tagName, 'H4');
assert.doesNotThrow(function() {
setTimeout(() => wrongElement.click());
setTimeout(() => correctElement.click(), 15);
});
},
示例8: it
it('should include default params when only callback is provided to API call', async () => {
const google = new GoogleApis();
const datastore = google.datastore({
version: 'v1',
params: {
// We must set this here - it is a required param
projectId: 'test-project-id',
myParam: '123',
},
});
// No params given - only callback
createNock('myParam=123');
const res = await datastore.projects.lookup();
// If the default param handling is broken, req or query might be
// undefined, thus concealing the assertion message with some generic
// "cannot call .indexOf of undefined"
const query = Utils.getQs(res) || '';
assert.notStrictEqual(
query.indexOf('myParam=123'),
-1,
'Default param not found in query'
);
nock.enableNetConnect();
const datastore2 = await Utils.loadApi(google, 'datastore', 'v1', {
params: {
projectId: 'test-project-id', // We must set this here - it is a
// required param
myParam: '123',
},
});
nock.disableNetConnect();
// No params given - only callback
createNock('myParam=123');
// tslint:disable-next-line no-any
const res3 = await (datastore2 as any).projects.lookup();
// If the default param handling is broken, req or query might be
// undefined, thus concealing the assertion message with some
// generic "cannot call .indexOf of undefined"
const query2 = Utils.getQs(res3) || '';
assert.notStrictEqual(
query2.indexOf('myParam=123'),
-1,
'Default param not found in query'
);
});
示例9: setTimeout
next: (root: Element) => {
const frameFoo = root.querySelector('.foo.frame') as HTMLElement;
const monalisaFoo = root.querySelector('.foo.monalisa') as HTMLElement;
assert.notStrictEqual(frameFoo, null);
assert.notStrictEqual(monalisaFoo, null);
assert.notStrictEqual(typeof frameFoo, 'undefined');
assert.notStrictEqual(typeof monalisaFoo, 'undefined');
assert.strictEqual(frameFoo.tagName, 'H4');
assert.strictEqual(monalisaFoo.tagName, 'SPAN');
assert.doesNotThrow(() => {
setTimeout(() => monalisaFoo.click());
setTimeout(() => monalisaFoo.click());
setTimeout(() => frameFoo.click(), 0);
});
},