コード例 #1
0
ファイル: news.test.ts プロジェクト: charlesyxh/examples
 it('should GET /news/item/:id', async () => {
   await app.httpRequest()
   .get('/news/item/1')
   // just a example, use regex to test part of dom string, but should be strong characteristic
   .expect(/\/news\/item\/1/)
   .expect(200);
 });
コード例 #2
0
ファイル: news.test.ts プロジェクト: charlesyxh/examples
 it('should GET /news/user/:id', async () => {
   await app.httpRequest()
   .get('/news/user/activatedgeek')
   // just a example, use regex to test part of dom string, but should be strong characteristic
   .expect(/<span class="label">user:<\/span> activatedgeek/)
   .expect(200);
 });
コード例 #3
0
 it('should GET /', async () => {
   const result = await app
     .httpRequest()
     .get('/')
     .expect(200);
   assert(result.text === 'hi, egg');
 });
コード例 #4
0
ファイル: index.test.ts プロジェクト: eggjs/egg-bin
 it('should work', async () => {
   await app
     .httpRequest()
     .get('/')
     .expect('hi, egg')
     .expect(200);
 });
コード例 #5
0
ファイル: news.test.ts プロジェクト: charlesyxh/examples
 it('should GET /news', async () => {
   const result = await app.httpRequest().get('/news').expect(200);
   const $ = cheerio.load(result.text);
   const listItem = $('.news-view .item');
   assert(listItem.length === app.config.news.pageSize);
 });
コード例 #6
0
ファイル: News.test.ts プロジェクト: charlesyxh/examples
 before(() => {
   ctx = app.mockContext();
 });
コード例 #7
0
 beforeEach(() => {
   app.mockCsrf();
 });
コード例 #8
0
 it('should visit / without error', () => {
   return app
     .httpRequest()
     .get('/')
     .expect(200);
 });
コード例 #9
0
 before(async () => {
   ctx = app.mockContext();
 });
コード例 #10
0
 before(async () => {
   await app.ready();
   ctx = app.mockContext({}) as Context;
 });