当前位置: 首页>>代码示例>>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;未经允许,请勿转载。