本文整理汇总了TypeScript中power-assert.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('Var should dispose observer', function() {
var a = new Var(1)
var b = new Obs(function() {a.apply()})
a.dispose(b)
assert(a.value === 1)
assert(a.observers.size === 0)
})
示例2: test
test(category + 'template with duplicated parameters', () => {
const p = path('/users/{id}/posts/{id}');
assert(p({}) === null);
assert(p({ id: 'a' }) === '/users/a/posts/a');
assert(p({ id: '' }) === '/users//posts/');
assert(p({ id: ' ' }) === '/users/%20/posts/%20');
}),
示例3: assert
.then((_) => {
assert(request.callCount === 1);
assert(request.getCall(0).args[0].method === 'put');
assert(request.getCall(0).args[0].path === '/atom/edit/123');
const body = request.getCall(0).args[0].body;
assert(body.entry.title._ === 'TITLE');
});
示例4: it
it("store.key check", async(() => {
const sc = new StoreController([new Store(null), new Store('second')]);
const mainStore = sc.getStoreSafely();
const secondStore = sc.getStoreSafely('second');
assert(mainStore.key === '__main__');
assert(secondStore.key === 'second');
}));
示例5: test
test('compileMarkdown with options', () => {
const markdown = 'http://example.com';
const html = compileMarkdown(markdown, { gfm: true });
assert(html === '<p><a href=\"http://example.com\">http://example.com</a></p>\n');
const htmlNoGfm = compileMarkdown(markdown, { gfm: false });
assert(htmlNoGfm === '<p>http://example.com</p>\n');
}),
示例6: test
test(category + '#newToken', fixture(setUp, tearDown, ({ token1 }) => {
const newToken = token1.newToken();
assert(newToken.getUsername() === token1.getUsername());
assert(newToken.getPassword() === token1.getPassword());
assert(newToken.getCreated() !== token1.getCreated());
assert(newToken.getNonce() !== token1.getNonce());
})),
示例7: it
it('exprimental', fakeAsyncPower(() => {
let fixture: ComponentFixture<Page1Component>;
builder.createAsync(Page1Component).then(f => fixture = f);
tick();
const component = fixture.componentRef.instance;
const el = fixture.nativeElement as HTMLElement;
const service = component.service;
let counter: number;
let currentTime: number;
let previousTime: number;
service.counter$.subscribe(value => counter = value);
service.timeNow$.subscribe(value => {
if (currentTime) {
previousTime = currentTime;
}
currentTime = value;
});
service.increment(1);
assert(counter === 1);
service.increment(1);
assert(counter === 2);
service.increment(2);
assert(counter === 4);
fixture.detectChanges();
console.log(elementText(el, '#now'));
tick(1000);
fixture.detectChanges();
console.log(elementText(el, '#now'));
}));
示例8: setTimeout
setTimeout(() => {
service.increment(1);
assert(value === 1);
service.increment(1);
assert(value === 2);
service.increment(2);
assert(value === 4);
}, 0);