我使用https://www.npmjs.com/package/gentest生成了一些规格文件 而且我能够运行测试而不会出现任何错误。就在我为应用提供服务时,我得到了这些。
webpack-dev-server -d --progress --colors --inline --config configs/webpackConfig/webpack.local.js --port 3000
base.service.spec.ts
import { async } from '@angular/core/testing';
import {BaseService} from './base.service';
describe('BaseService', () => {
let service;
const httpClient: any = {
// mock properties here
}
const loggerService: any = {
// mock properties here
}
beforeEach(() => {
service = new BaseService(httpClient,loggerService);
});
it('should run #postData()', async () => {
// const result = postData(url, data, headers, apimKey);
});
it('should run #getData()', async () => {
// const result = getData(url, headers, apimKey);
});
it('should run #deleteData()', async () => {
// const result = deleteData(url, headers);
});
it('should run #handleError()', async () => {
// const result = handleError(operation, result);
});
it('should run #postMethod()', async () => {
// const result = postMethod(url, data, headers);
});
});