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


TypeScript supertest.default函數代碼示例

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


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

示例1: it

      it('should retun 400 if request is invalid', async () => {
        const response = await request(app)
          .post('/api/dios')
          .set('Accept', 'application/json')
          .set('x-access-token', user.token)
          .send({
            dioId: 1,
            name: 'test_post',
            roomId: '0fc1d78e-fd1c-4717-b610-65d2fa3d01b2',
            admin: true,
          });

        expect(response.status).toBeBadRequest();
      });
開發者ID:7h1b0,項目名稱:Anna,代碼行數:14,代碼來源:dio.test.ts

示例2: it

      it('should retun 200 when user is authenticated', async () => {
        const response = await request(app)
          .get('/api/users')
          .set('Accept', 'application/json')
          .set('x-access-token', user.token)
          .send();

        expect(response.body).toEqual([
          {
            username: user.username,
            userId: user.userId,
          },
        ]);
      });
開發者ID:7h1b0,項目名稱:Anna,代碼行數:14,代碼來源:user.test.ts

示例3: it

    it('should run the routine', async () => {
      const runSpy = jest.spyOn(Routine, 'run');
      const response = await request(app)
        .get(`/api/routines/${initRoutines[0].routineId}/action`)
        .set('Accept', 'application/json')
        .set('x-access-token', user.token);

      expect(response.status).toHaveStatusOk();
      expect(response.body).toEqual({});
      expect(Routine.run).toHaveBeenCalled();

      expect(runSpy.mock.calls).toMatchSnapshot();
      runSpy.mockRestore();
    });
開發者ID:7h1b0,項目名稱:Anna,代碼行數:14,代碼來源:routine.test.ts

示例4: expect

 it('can handle a basic implicit GET request', () => {
     app = createApp();
     const expected = {
         testString: 'it works',
     };
     const query = {
         query: '{ testString }',
     };
     const req = request(app)
         .get('/graphql').query(query);
     return req.then((res) => {
         expect(res.status).to.equal(200);
         return expect(res.body.data).to.deep.equal(expected);
     });
 });
開發者ID:convoyinc,項目名稱:apollo-server,代碼行數:15,代碼來源:index.ts


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