本文整理匯總了TypeScript中mocha.afterEach函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript afterEach函數的具體用法?TypeScript afterEach怎麽用?TypeScript afterEach使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了afterEach函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: describe
describe('TypeScript Usage', function() {
beforeEach(function() {
this.server = new Pretender();
});
afterEach(function() {
this.server.shutdown();
});
describe('generics in HTTP methods', function() {
describe('request', function() {
beforeEach(function() {
this.server.get('/users/1', () => jsonResponse(200, { name: 'Alex' }));
});
it('works without the generic defined', async function() {
const ajax = new AjaxRequest();
const response = await ajax.request('/users/1');
expect(response).to.deep.equal({ name: 'Alex' });
});
it('can provide a generic type to resolve to', async function() {
const ajax = new AjaxRequest();
const response = await ajax.request<User>('/users/1');
expect(response).to.deep.equal({ name: 'Alex' });
});
});
});
it('types the injected service', function() {
Service.extend({
ajax: service('ajax'),
makeRequest<T>(url: string) {
return this.get('ajax').request<T>(url);
}
});
});
});
示例2: describeModule
describeModule('component:x-foo', 'TestModule callbacks', function() {
before(function() {
class I18n extends Ember.Object {}
this.skip();
this.timeout(1000);
this.registry.register('helper:i18n', I18n);
this.registry.register('helper:i18n', I18n, { singleton: true });
this.register('service:i18n', {});
this.inject.service('i18n');
this.inject.service('i18n', { as: 'i18n' });
this.factory('object:user').create();
});
after(function() {
});
beforeEach(function() {
});
afterEach(function() {
});
});