本文整理汇总了TypeScript中jsverify.assert函数的典型用法代码示例。如果您正苦于以下问题:TypeScript assert函数的具体用法?TypeScript assert怎么用?TypeScript assert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should interact correctly', () => {
const property = forall(diagramArbitrary, diagramArbitrary, (addDiagram, subtractDiagram) => {
const Time = mockTimeSource();
const add$ = Time.diagram(addDiagram);
const subtract$ = Time.diagram(subtractDiagram);
const DOM = mockDOMSource({
'.add': { click: add$ },
'.subtract': { click: subtract$ }
});
const app = onionify(App)({ DOM } as any);
const html$ = app.DOM.map(toHtml);
const expected$ = xs.merge(add$.mapTo(+1), subtract$.mapTo(-1))
.fold((acc, curr) => acc + curr, 0)
.map(expectedHTML);
Time.assertEqual(html$, expected$, htmlLooksLike);
return promise(Time.run);
});
return assert(property, testOptions);
});
示例2: it
it('should interact correctly', () => {
const property = forall(
diagramArbitrary,
diagramArbitrary,
(addDiagram, subtractDiagram) =>
withTime(Time => {
const add$ = Time.diagram(addDiagram)
const subtract$ = Time.diagram(subtractDiagram)
const DOM = mockDOMSource({
'.add': { click: add$ },
'.subtract': { click: subtract$ }
})
const app = onionify(App)({ DOM } as any)
const html$ = (app.DOM as Stream<VNode>).map(toHtml)
const expected$ = xs
.merge(add$.mapTo(+1), subtract$.mapTo(-1))
.fold((acc, curr) => acc + curr, 0)
.map(expectedHTML)
Time.assertEqual(html$, expected$, htmlLooksLike)
})
)
return assert(property, testOptions)
})
示例3: it
it('reflection 2', () =>
jsv.assert(
jsv.forall(
httpVersionArb(),
httpVersionArb(),
(a, b) => a.equals(b) === b.equals(a)
)
)
示例4: it
it('Left value is untouched', () =>
jsv.assert(
jsv.forall(
leftArb(jsv.json),
jsv.fn(jsv.json),
(a, f) => deepEq(E.mapEither(a, f), a)
)
)