當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript task.forInPar_函數代碼示例

本文整理匯總了TypeScript中@jonggrang/task.forInPar_函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript forInPar_函數的具體用法?TypeScript forInPar_怎麽用?TypeScript forInPar_使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了forInPar_函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

  it('storage.destroyAllOfAuthId should only delete relevant Auth Id', function* () {
    const master: Session = yield generateSession(HasAuthId.HAS_AUTH_ID);
    const authId = master.authId as string;

    const preslaves: Session[] = yield (replicateA(20, generateSession(HasAuthId.HAS_AUTH_ID))
      .concat(replicateA(20, generateSession(HasAuthId.NO_AUTH_ID)))
    );
    const slaves = preslaves.map(x => createSession(x.id, authId, x.data, x.createdAt, x.accessedAt));

    const others: Session[] = yield (replicateA(20, generateSession(HasAuthId.HAS_AUTH_ID))
      .concat(replicateA(20, generateSession(HasAuthId.NO_AUTH_ID)))
    );
    const allS = [master].concat(slaves, others);

    // insert session
    yield T.forInPar_([master].concat(preslaves, others), x => run(storage.insert(x)));
    yield T.forInPar_(slaves, x => run(storage.replace(x)));

    const xs: (Session | null)[] = yield T.forInPar(allS, x => run(storage.get(x.id)));
    assert.deepEqual(xs, allS);
    yield run(storage.destroyAllOfAuthId(authId));
    const ys: (Session | null)[] = yield T.forInPar(allS, x => run(storage.get(x.id)));
    const xxs = new Array(slaves.length + 1).fill(null);
    assert.deepEqual(ys, xxs.concat(others as any));
    return T.pure(true);
  });
開發者ID:syaiful6,項目名稱:jonggrang,代碼行數:26,代碼來源:storage-test.ts

示例2: done

 pendingWrites.onceZero(() => {
   T.runTask(T.forInPar_(uploadedFiles, file => storage.removeFile(file)), (err) => {
     /* istanbul ignore if */
     if (err) return done(err);
     done(uploadError);
   });
 });
開發者ID:syaiful6,項目名稱:jonggrang,代碼行數:7,代碼來源:parser.ts

示例3: it

 it('correctly handle partial files', function () {
   return T.toPromise(T.forInPar_(
     [ [17, 2, 2, '23']
     , [17, 0, 2, '01']
     , [17, 3, 8, '3456789a']
     ] as [number, number, number, string][],
     ([a, b, c, d]) => testPartial(a, b, c, d)
   ));
 });
開發者ID:syaiful6,項目名稱:jonggrang,代碼行數:9,代碼來源:respond.test.ts

示例4: it

 it('403 for unsafe paths', () => {
   function sendReq(path: string) {
     const req = new IncomingMessageMock({ url: path });
     return request(staticTest, req).map(resp => {
       assert.equal(resp.status, 403);
     });
   }
   return T.toPromise(T.forInPar_(['/..', '/.'], sendReq));
 });
開發者ID:syaiful6,項目名稱:jonggrang,代碼行數:9,代碼來源:static.test.ts

示例5: request

 return T.toPromise(withApp(headApp, handler =>
   T.forInPar_(['buffer', 'streaming', 'file', 'readable'], p => {
     return T.makeTask(cb => {
       request(handler)
         .head(`/${p}`)
         .expect(200)
         .expect((res: request.Response) => {
           assert.ok(!res.text);
         })
         .end(cb);
       return T.nonCanceler;
     });
   })
開發者ID:syaiful6,項目名稱:jonggrang,代碼行數:13,代碼來源:respond.test.ts


注:本文中的@jonggrang/task.forInPar_函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。