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


TypeScript supertest-as-promised類代碼示例

本文整理匯總了TypeScript中supertest-as-promised的典型用法代碼示例。如果您正苦於以下問題:TypeScript supertest-as-promised類的具體用法?TypeScript supertest-as-promised怎麽用?TypeScript supertest-as-promised使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: supertest

 test('honors the cache max evicting least recently used', async() => {
   await supertest(app).get('/components/test-component/test.html');
   assert(babelCompileCache.has(uncompiledHtml));
   const originalMax = babelCompileCache['max'];
   babelCompileCache['max'] = babelCompileCache.length;
   try {
     await supertest(app).get('/components/test-component/test.js');
     assert(!babelCompileCache.has(uncompiledHtml), 'cached html evicted');
   } finally {
     babelCompileCache['max'] = originalMax;
   }
 });
開發者ID:tony19-contrib,項目名稱:polyserve,代碼行數:12,代碼來源:compile-middleware_test.ts

示例2: beforeEach

 beforeEach((done: DoneFn) => {
     request(server.getApp())
         .get("/api/user/1/address/2")
         .expect(200)
         .then(() => done())
         .catch((error: any) => done.fail(error));
 });
開發者ID:antoniolopesgomes,項目名稱:tedi,代碼行數:7,代碼來源:express-server-params.spec.ts

示例3: setUpProxy

 test('rewrites directory with proxy', async() => {
   await setUpProxy('normally-non-existing-path');
   await supertest(proxyServer)
       .get(
           '/normally-non-existing-path/bower_components/test-component/test-file.txt')
       .expect(200, 'TEST COMPONENT\n');
 });
開發者ID:tony19-contrib,項目名稱:polyserve,代碼行數:7,代碼來源:start_server_test.ts

示例4: beforeEach

        beforeEach((done: DoneFn) => {

            app
                .use("/user/info", (err: any, req: any, res: any, next: any) => {
                    err.$handlers.push("info error handler");
                    next(err);
                })
                .use("/user", (err: any, req: any, res: any, next: any) => {
                    err.$handlers.push("user error handler");
                    next(err);
                })
                .use((err: any, req: any, res: any, next: any) => {
                    err.$handlers.push("app error handler");
                    res.status(500).send(err.$handlers);
                });

            spyOn(controller, "fn").and.callFake((req, res, next) => {
                next({ $handlers: [] });
            });

            request(app)
                .get("/user/info")
                .expect(500)
                .then((res: request.Response) => {
                    response = res;
                    done();
                })
                .catch((error) => done.fail(error));
        });
開發者ID:antoniolopesgomes,項目名稱:tedi,代碼行數:29,代碼來源:express-app.spec.ts

示例5: async

test("isLogged:Error", async(t) => {
    const res = await request(app)
        .post("/test/api/user/isLogged")
        .set("authorization", "nope");

    t.is(res.status, 401);
    t.falsy(res.body.isSuccess);
});
開發者ID:dominikus1993,項目名稱:twitterClone,代碼行數:8,代碼來源:controllerTest.ts

示例6: beforeEach

 beforeEach((done: DoneFn) => {
     spyOn(server.getDependency<ControllerClass>(ControllerClass), "read").and.callThrough();
     request(expressApp)
         .get("/controllers")
         .expect(200)
         .then(() => done())
         .catch((error) => done.fail(error));
 });
開發者ID:antoniolopesgomes,項目名稱:tedi,代碼行數:8,代碼來源:express-server.spec.ts

示例7: supertest

 test('serves index.html, not 404', async() => {
   const app = getApp({root});
   await supertest(app).get('/foo').expect(200).expect((res: any) => {
     if (!res.text.includes('INDEX')) {
       throw new Error('Expected body to contain INDEX');
     }
   });
 });
開發者ID:tony19-contrib,項目名稱:polyserve,代碼行數:8,代碼來源:start_server_test.ts


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