本文整理汇总了TypeScript中egg-mock/bootstrap.app类的典型用法代码示例。如果您正苦于以下问题:TypeScript app类的具体用法?TypeScript app怎么用?TypeScript app使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了app类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
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: it
it('should GET /', async () => {
const result = await app
.httpRequest()
.get('/')
.expect(200);
assert(result.text === 'hi, egg');
});
示例3: it
it('should work', async () => {
await app
.httpRequest()
.get('/')
.expect('hi, egg')
.expect(200);
});
示例4: before
before(() => {
ctx = app.mockContext();
});
示例5: beforeEach
beforeEach(() => {
app.mockCsrf();
});
示例6: it
it('should visit / without error', () => {
return app
.httpRequest()
.get('/')
.expect(200);
});
示例7: before
before(async () => {
ctx = app.mockContext();
});
示例8: before
before(async () => {
await app.ready();
ctx = app.mockContext({}) as Context;
});