本文整理匯總了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);