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