本文整理汇总了TypeScript中@jonggrang/task.bothPar函数的典型用法代码示例。如果您正苦于以下问题:TypeScript bothPar函数的具体用法?TypeScript bothPar怎么用?TypeScript bothPar使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bothPar函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: sendIfModifiedSince
function sendIfModifiedSince(date: string) {
const req = new IncomingMessageMock({
url: '/attic/a',
headers: {
'If-Modified-Since': date
}
});
return T.bothPar(fileDate, request(fileServer, req)).map(([mdate, resp]) => {
assert.equal(resp.status, 200);
assert.equal(resp.headers['Last-Modified'], mdate);
});
}
示例2: it
it('can move file upload to target dir', async function () {
const middleware = mutter({ getStorage });
const form = new FormData();
form.append('name', 'thatiq');
form.append('tiny0', file('tiny0.json'));
const { state } = await T.toPromise(submitForm(middleware, form));
const dest = await T.toPromise(T.node(null, temp.mkdir));
const files: Files = state.files;
const target = path.join(dest, 'tiny-uploaded.json');
await T.toPromise(files['tiny0'][0].move(target));
const [targetStat, sourceStat] = await T.toPromise(T.bothPar(
T.node(null, target, fs.stat),
T.node(null, path.join(__dirname, 'fixtures', 'tiny0.json'), fs.stat)
));
assert.equal(targetStat.size, sourceStat.size);
await T.toPromise(T.node(null, dest, rimraf));
});
示例3:
export async function tdeepEq<A>(t: T.Task<A>, t2: T.Task<A>): Promise<void> {
const [a, b] = await T.toPromise(T.bothPar(t, t2));
assert.deepEqual(a, b);
}
示例4: it
it('randomString can generate random string', () =>
shouldBe([32, 22], T.bothPar(
Crypt.randomString(32),
Crypt.randomString(22)
).map(xs => xs.map(x => x.length)))