mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-16 15:40:11 +01:00
Got rid of tests.
This commit is contained in:
parent
6558ee2fc4
commit
1ecaf82998
16 changed files with 2 additions and 710 deletions
|
|
@ -1,90 +0,0 @@
|
|||
/**
|
||||
* @author: @AngularClass
|
||||
*/
|
||||
|
||||
module.exports = function(config) {
|
||||
var testWebpackConfig = require('./webpack.test.js');
|
||||
|
||||
config.set({
|
||||
|
||||
// base path that will be used to resolve all patterns (e.g. files, exclude)
|
||||
basePath: '',
|
||||
|
||||
/*
|
||||
* Frameworks to use
|
||||
*
|
||||
* available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||
*/
|
||||
frameworks: ['jasmine'],
|
||||
|
||||
// list of files to exclude
|
||||
exclude: [ ],
|
||||
|
||||
/*
|
||||
* list of files / patterns to load in the browser
|
||||
*
|
||||
* we are building the test environment in ./spec-bundle.js
|
||||
*/
|
||||
files: [ { pattern: './config/spec-bundle.js', watched: false } ],
|
||||
|
||||
/*
|
||||
* preprocess matching files before serving them to the browser
|
||||
* available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||
*/
|
||||
preprocessors: { './config/spec-bundle.js': ['coverage', 'webpack', 'sourcemap'] },
|
||||
|
||||
// Webpack Config at ./webpack.test.js
|
||||
webpack: testWebpackConfig,
|
||||
|
||||
coverageReporter: {
|
||||
dir : 'coverage/',
|
||||
reporters: [
|
||||
{ type: 'text-summary' },
|
||||
{ type: 'json' },
|
||||
{ type: 'html' }
|
||||
]
|
||||
},
|
||||
|
||||
// Webpack please don't spam the console when running in karma!
|
||||
webpackServer: { noInfo: true },
|
||||
|
||||
/*
|
||||
* test results reporter to use
|
||||
*
|
||||
* possible values: 'dots', 'progress'
|
||||
* available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||
*/
|
||||
reporters: [ 'mocha', 'coverage' ],
|
||||
|
||||
// web server port
|
||||
port: 9876,
|
||||
|
||||
// enable / disable colors in the output (reporters and logs)
|
||||
colors: true,
|
||||
|
||||
/*
|
||||
* level of logging
|
||||
* possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
*/
|
||||
logLevel: config.LOG_INFO,
|
||||
|
||||
// enable / disable watching file and executing tests whenever any file changes
|
||||
autoWatch: false,
|
||||
|
||||
/*
|
||||
* start these browsers
|
||||
* available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||
*/
|
||||
browsers: [
|
||||
// 'Chrome',
|
||||
'PhantomJS'
|
||||
],
|
||||
|
||||
/*
|
||||
* Continuous Integration mode
|
||||
* if true, Karma captures browsers, runs the tests and exits
|
||||
*/
|
||||
singleRun: true
|
||||
});
|
||||
|
||||
};
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/**
|
||||
* @author: @AngularClass
|
||||
*/
|
||||
|
||||
require('ts-node/register');
|
||||
var helpers = require('./helpers');
|
||||
|
||||
exports.config = {
|
||||
baseUrl: 'http://localhost:3000/',
|
||||
|
||||
// use `npm run e2e`
|
||||
specs: [
|
||||
helpers.root('src/**/**.e2e.ts'),
|
||||
helpers.root('src/**/*.e2e.ts')
|
||||
],
|
||||
exclude: [],
|
||||
|
||||
framework: 'jasmine2',
|
||||
|
||||
allScriptsTimeout: 110000,
|
||||
|
||||
jasmineNodeOpts: {
|
||||
showTiming: true,
|
||||
showColors: true,
|
||||
isVerbose: false,
|
||||
includeStackTrace: false,
|
||||
defaultTimeoutInterval: 400000
|
||||
},
|
||||
directConnect: true,
|
||||
|
||||
capabilities: {
|
||||
'browserName': 'chrome',
|
||||
'chromeOptions': {
|
||||
'args': ['show-fps-counter=true']
|
||||
}
|
||||
},
|
||||
|
||||
onPrepare: function() {
|
||||
browser.ignoreSynchronization = true;
|
||||
},
|
||||
|
||||
seleniumServerJar: 'node_modules/protractor/selenium/selenium-server-standalone-2.52.0.jar',
|
||||
|
||||
/**
|
||||
* Angular 2 configuration
|
||||
*
|
||||
* useAllAngular2AppRoots: tells Protractor to wait for any angular2 apps on the page instead of just the one matching
|
||||
* `rootEl`
|
||||
*/
|
||||
useAllAngular2AppRoots: true
|
||||
};
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
/**
|
||||
* @author: @AngularClass
|
||||
*/
|
||||
|
||||
/*
|
||||
* When testing with webpack and ES6, we have to do some extra
|
||||
* things get testing to work right. Because we are gonna write test
|
||||
* in ES6 to, we have to compile those as well. That's handled in
|
||||
* karma.conf.js with the karma-webpack plugin. This is the entry
|
||||
* file for webpack test. Just like webpack will create a bundle.js
|
||||
* file for our client, when we run test, it well compile and bundle them
|
||||
* all here! Crazy huh. So we need to do some setup
|
||||
*/
|
||||
Error.stackTraceLimit = Infinity;
|
||||
|
||||
require('core-js');
|
||||
|
||||
// Typescript emit helpers polyfill
|
||||
require('ts-helpers');
|
||||
|
||||
require('zone.js/dist/zone');
|
||||
require('zone.js/dist/long-stack-trace-zone');
|
||||
require('zone.js/dist/jasmine-patch');
|
||||
|
||||
// RxJS
|
||||
require('rxjs/Rx');
|
||||
|
||||
var testing = require('angular2/testing');
|
||||
var browser = require('angular2/platform/testing/browser');
|
||||
|
||||
testing.setBaseTestProviders(
|
||||
browser.TEST_BROWSER_PLATFORM_PROVIDERS,
|
||||
browser.TEST_BROWSER_APPLICATION_PROVIDERS
|
||||
);
|
||||
|
||||
Object.assign(global, testing);
|
||||
|
||||
/*
|
||||
* Ok, this is kinda crazy. We can use the the context method on
|
||||
* require that webpack created in order to tell webpack
|
||||
* what files we actually want to require or import.
|
||||
* Below, context will be an function/object with file names as keys.
|
||||
* using that regex we are saying look in ./src/app and ./test then find
|
||||
* any file that ends with spec.js and get its path. By passing in true
|
||||
* we say do this recursively
|
||||
*/
|
||||
var testContext = require.context('../src', true, /\.spec\.ts/);
|
||||
|
||||
/*
|
||||
* get all the files, for each file, call the context function
|
||||
* that will require the file and load it up here. Context will
|
||||
* loop and require those spec files here
|
||||
*/
|
||||
function requireAll(requireContext) {
|
||||
return requireContext.keys().map(requireContext);
|
||||
}
|
||||
|
||||
// requires and returns all modules that match
|
||||
var modules = requireAll(testContext);
|
||||
|
|
@ -1,233 +0,0 @@
|
|||
/**
|
||||
* @author: @AngularClass
|
||||
*/
|
||||
|
||||
const helpers = require('./helpers');
|
||||
|
||||
/**
|
||||
* Webpack Plugins
|
||||
*/
|
||||
const ProvidePlugin = require('webpack/lib/ProvidePlugin');
|
||||
const DefinePlugin = require('webpack/lib/DefinePlugin');
|
||||
|
||||
/**
|
||||
* Webpack Constants
|
||||
*/
|
||||
const ENV = process.env.ENV = process.env.NODE_ENV = 'test';
|
||||
|
||||
/**
|
||||
* Webpack configuration
|
||||
*
|
||||
* See: http://webpack.github.io/docs/configuration.html#cli
|
||||
*/
|
||||
module.exports = {
|
||||
|
||||
/**
|
||||
* Source map for Karma from the help of karma-sourcemap-loader & karma-webpack
|
||||
*
|
||||
* Do not change, leave as is or it wont work.
|
||||
* See: https://github.com/webpack/karma-webpack#source-maps
|
||||
*/
|
||||
devtool: 'inline-source-map',
|
||||
|
||||
/**
|
||||
* Options affecting the resolving of modules.
|
||||
*
|
||||
* See: http://webpack.github.io/docs/configuration.html#resolve
|
||||
*/
|
||||
resolve: {
|
||||
|
||||
/**
|
||||
* An array of extensions that should be used to resolve modules.
|
||||
*
|
||||
* See: http://webpack.github.io/docs/configuration.html#resolve-extensions
|
||||
*/
|
||||
extensions: ['', '.ts', '.js'],
|
||||
|
||||
/**
|
||||
* Make sure root is src
|
||||
*/
|
||||
root: helpers.root('src'),
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Options affecting the normal modules.
|
||||
*
|
||||
* See: http://webpack.github.io/docs/configuration.html#module
|
||||
*/
|
||||
module: {
|
||||
|
||||
/**
|
||||
* An array of applied pre and post loaders.
|
||||
*
|
||||
* See: http://webpack.github.io/docs/configuration.html#module-preloaders-module-postloaders
|
||||
*/
|
||||
preLoaders: [
|
||||
|
||||
/**
|
||||
* Tslint loader support for *.ts files
|
||||
*
|
||||
* See: https://github.com/wbuchwalter/tslint-loader
|
||||
*/
|
||||
{
|
||||
test: /\.ts$/,
|
||||
loader: 'tslint-loader',
|
||||
exclude: [helpers.root('node_modules')]
|
||||
},
|
||||
|
||||
/**
|
||||
* Source map loader support for *.js files
|
||||
* Extracts SourceMaps for source files that as added as sourceMappingURL comment.
|
||||
*
|
||||
* See: https://github.com/webpack/source-map-loader
|
||||
*/
|
||||
{
|
||||
test: /\.js$/,
|
||||
loader: 'source-map-loader',
|
||||
exclude: [
|
||||
// these packages have problems with their sourcemaps
|
||||
helpers.root('node_modules/rxjs'),
|
||||
helpers.root('node_modules/@angular2-material')
|
||||
]}
|
||||
|
||||
],
|
||||
|
||||
/**
|
||||
* An array of automatically applied loaders.
|
||||
*
|
||||
* IMPORTANT: The loaders here are resolved relative to the resource which they are applied to.
|
||||
* This means they are not resolved relative to the configuration file.
|
||||
*
|
||||
* See: http://webpack.github.io/docs/configuration.html#module-loaders
|
||||
*/
|
||||
loaders: [
|
||||
|
||||
/**
|
||||
* Typescript loader support for .ts and Angular 2 async routes via .async.ts
|
||||
*
|
||||
* See: https://github.com/s-panferov/awesome-typescript-loader
|
||||
*/
|
||||
{
|
||||
test: /\.ts$/,
|
||||
loader: 'awesome-typescript-loader',
|
||||
query: {
|
||||
compilerOptions: {
|
||||
|
||||
// Remove TypeScript helpers to be injected
|
||||
// below by DefinePlugin
|
||||
removeComments: true
|
||||
|
||||
}
|
||||
},
|
||||
exclude: [/\.e2e\.ts$/]
|
||||
},
|
||||
|
||||
/**
|
||||
* Json loader support for *.json files.
|
||||
*
|
||||
* See: https://github.com/webpack/json-loader
|
||||
*/
|
||||
{ test: /\.json$/, loader: 'json-loader', exclude: [helpers.root('src/index.html')] },
|
||||
|
||||
/**
|
||||
* Raw loader support for *.css files
|
||||
* Returns file content as string
|
||||
*
|
||||
* See: https://github.com/webpack/raw-loader
|
||||
*/
|
||||
{ test: /\.css$/, loader: 'raw-loader', exclude: [helpers.root('src/index.html')] },
|
||||
|
||||
/**
|
||||
* Raw loader support for *.html
|
||||
* Returns file content as string
|
||||
*
|
||||
* See: https://github.com/webpack/raw-loader
|
||||
*/
|
||||
{ test: /\.html$/, loader: 'raw-loader', exclude: [helpers.root('src/index.html')] }
|
||||
|
||||
],
|
||||
|
||||
/**
|
||||
* An array of applied pre and post loaders.
|
||||
*
|
||||
* See: http://webpack.github.io/docs/configuration.html#module-preloaders-module-postloaders
|
||||
*/
|
||||
postLoaders: [
|
||||
|
||||
/**
|
||||
* Instruments JS files with Istanbul for subsequent code coverage reporting.
|
||||
* Instrument only testing sources.
|
||||
*
|
||||
* See: https://github.com/deepsweet/istanbul-instrumenter-loader
|
||||
*/
|
||||
{
|
||||
test: /\.(js|ts)$/, loader: 'istanbul-instrumenter-loader',
|
||||
include: helpers.root('src'),
|
||||
exclude: [
|
||||
/\.(e2e|spec)\.ts$/,
|
||||
/node_modules/
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
|
||||
/**
|
||||
* Add additional plugins to the compiler.
|
||||
*
|
||||
* See: http://webpack.github.io/docs/configuration.html#plugins
|
||||
*/
|
||||
plugins: [
|
||||
|
||||
/**
|
||||
* Plugin: DefinePlugin
|
||||
* Description: Define free variables.
|
||||
* Useful for having development builds with debug logging or adding global constants.
|
||||
*
|
||||
* Environment helpers
|
||||
*
|
||||
* See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin
|
||||
*/
|
||||
// NOTE: when adding more properties make sure you include them in custom-typings.d.ts
|
||||
new DefinePlugin({
|
||||
'ENV': JSON.stringify(ENV),
|
||||
'HMR': false,
|
||||
'process.env': {
|
||||
'ENV': JSON.stringify(ENV),
|
||||
'NODE_ENV': JSON.stringify(ENV),
|
||||
'HMR': false,
|
||||
}
|
||||
}),
|
||||
|
||||
|
||||
],
|
||||
|
||||
/**
|
||||
* Static analysis linter for TypeScript advanced options configuration
|
||||
* Description: An extensible linter for the TypeScript language.
|
||||
*
|
||||
* See: https://github.com/wbuchwalter/tslint-loader
|
||||
*/
|
||||
tslint: {
|
||||
emitErrors: false,
|
||||
failOnHint: false,
|
||||
resourcePath: 'src'
|
||||
},
|
||||
|
||||
/**
|
||||
* Include polyfills or mocks for various node stuff
|
||||
* Description: Node configuration
|
||||
*
|
||||
* See: https://webpack.github.io/docs/configuration.html#node
|
||||
*/
|
||||
node: {
|
||||
global: 'window',
|
||||
process: false,
|
||||
crypto: 'empty',
|
||||
module: false,
|
||||
clearImmediate: false,
|
||||
setImmediate: false
|
||||
}
|
||||
|
||||
};
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
/**
|
||||
* @author: @AngularClass
|
||||
*/
|
||||
|
||||
// Look in ./config for karma.conf.js
|
||||
module.exports = require('./config/karma.conf.js');
|
||||
23
package.json
23
package.json
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "angular2-webpack-starter",
|
||||
"version": "5.0.4",
|
||||
"description": "An Angular 2 Webpack Starter kit featuring Angular 2 (Router, Http, Forms, Services, Tests, E2E, Coverage), Karma, Protractor, Jasmine, Istanbul, TypeScript, and Webpack by AngularClass",
|
||||
"description": "Angular 2 admin template.",
|
||||
"author": "Patrick Stapleton <patrick@angularclass.com>",
|
||||
"homepage": "https://github.com/angularclass/angular2-webpack-starter",
|
||||
"license": "MIT",
|
||||
|
|
@ -13,7 +13,6 @@
|
|||
"webpack": "webpack",
|
||||
"webpack-dev-server": "webpack-dev-server",
|
||||
"webdriver-manager": "webdriver-manager",
|
||||
"protractor": "protractor",
|
||||
|
||||
"clean": "npm cache clean && npm run rimraf -- node_modules doc typings coverage dist",
|
||||
"clean:dist": "npm run rimraf -- dist",
|
||||
|
|
@ -25,7 +24,6 @@
|
|||
"watch": "npm run watch:dev",
|
||||
"watch:dev": "npm run build:dev -- --watch",
|
||||
"watch:dev:hmr": "npm run watch:dev -- --hot",
|
||||
"watch:test": "npm run test -- --auto-watch --no-single-run",
|
||||
"watch:prod": "npm run build:prod -- --watch",
|
||||
|
||||
"build": "npm run build:dev",
|
||||
|
|
@ -44,14 +42,6 @@
|
|||
|
||||
"lint": "npm run tslint 'src/**/*.ts'",
|
||||
|
||||
"pree2e": "npm run webdriver:update -- --standalone",
|
||||
"e2e": "npm run protractor",
|
||||
"e2e:live": "npm run e2e -- --elementExplorer",
|
||||
|
||||
"test": "node --max-old-space-size=4096 node_modules/karma/bin/karma start",
|
||||
|
||||
"ci": "npm run e2e && npm run test",
|
||||
|
||||
"docs": "npm run typedoc -- --options typedoc.json --exclude '**/*.spec.ts' ./src/",
|
||||
|
||||
"start": "npm run server:dev",
|
||||
|
|
@ -59,7 +49,7 @@
|
|||
|
||||
"postinstall": "npm run typings -- install",
|
||||
|
||||
"preversion": "npm test",
|
||||
"preversion": "npm run build",
|
||||
"version": "npm run build",
|
||||
"postversion": "git push && git push --tags"
|
||||
|
||||
|
|
@ -100,18 +90,9 @@
|
|||
"imports-loader": "^0.6.5",
|
||||
"istanbul-instrumenter-loader": "^0.2.0",
|
||||
"json-loader": "^0.5.4",
|
||||
"karma": "^0.13.22",
|
||||
"karma-chrome-launcher": "^0.2.3",
|
||||
"karma-coverage": "^0.5.5",
|
||||
"karma-jasmine": "^0.3.8",
|
||||
"karma-mocha-reporter": "^2.0.0",
|
||||
"karma-phantomjs-launcher": "^1.0.0",
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-webpack": "1.7.0",
|
||||
"parse5": "^2.1.5",
|
||||
"phantomjs-polyfill": "0.0.2",
|
||||
"phantomjs-prebuilt": "^2.1.7",
|
||||
"protractor": "^3.2.2",
|
||||
"raw-loader": "0.5.1",
|
||||
"remap-istanbul": "^0.5.1",
|
||||
"rimraf": "^2.5.2",
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
/**
|
||||
* @author: @AngularClass
|
||||
*/
|
||||
|
||||
// look in ./config for protractor.conf.js
|
||||
exports.config = require('./config/protractor.conf.js').config;
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
import {
|
||||
it,
|
||||
inject,
|
||||
injectAsync,
|
||||
describe,
|
||||
beforeEachProviders,
|
||||
TestComponentBuilder
|
||||
} from 'angular2/testing';
|
||||
|
||||
import {Component, provide} from 'angular2/core';
|
||||
|
||||
// Load the implementations that should be tested
|
||||
import {About} from './about.component';
|
||||
|
||||
describe('About', () => {
|
||||
// provide our implementations or mocks to the dependency injector
|
||||
beforeEachProviders(() => [
|
||||
About
|
||||
]);
|
||||
|
||||
it('should log ngOnInit', inject([ About ], (about) => {
|
||||
spyOn(console, 'log');
|
||||
expect(console.log).not.toHaveBeenCalled();
|
||||
|
||||
about.ngOnInit();
|
||||
expect(console.log).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
describe('App', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
browser.get('/');
|
||||
});
|
||||
|
||||
|
||||
it('should have a title', () => {
|
||||
let subject = browser.getTitle();
|
||||
let result = 'Angular2 Webpack Starter by @gdi2290 from @AngularClass';
|
||||
expect(subject).toEqual(result);
|
||||
});
|
||||
|
||||
it('should have <header>', () => {
|
||||
let subject = element(by.css('app header')).isPresent();
|
||||
let result = true;
|
||||
expect(subject).toEqual(result);
|
||||
});
|
||||
|
||||
it('should have <main>', () => {
|
||||
let subject = element(by.css('app main')).isPresent();
|
||||
let result = true;
|
||||
expect(subject).toEqual(result);
|
||||
});
|
||||
|
||||
it('should have <footer>', () => {
|
||||
let subject = element(by.css('app footer')).getText();
|
||||
let result = 'WebPack Angular 2 Starter by @AngularClass';
|
||||
expect(subject).toEqual(result);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
import {
|
||||
it,
|
||||
inject,
|
||||
injectAsync,
|
||||
beforeEachProviders,
|
||||
TestComponentBuilder
|
||||
} from 'angular2/testing';
|
||||
|
||||
// Load the implementations that should be tested
|
||||
import {App} from './app.component';
|
||||
import {AppState} from './app.service';
|
||||
|
||||
describe('App', () => {
|
||||
// provide our implementations or mocks to the dependency injector
|
||||
beforeEachProviders(() => [
|
||||
AppState,
|
||||
App
|
||||
]);
|
||||
|
||||
it('should have a url', inject([ App ], (app) => {
|
||||
expect(app.url).toEqual('https://twitter.com/AngularClass');
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
describe('App', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
// change hash depending on router LocationStrategy
|
||||
browser.get('/#/home');
|
||||
});
|
||||
|
||||
|
||||
it('should have a title', () => {
|
||||
let subject = browser.getTitle();
|
||||
let result = 'Angular2 Webpack Starter by @gdi2290 from @AngularClass';
|
||||
expect(subject).toEqual(result);
|
||||
});
|
||||
|
||||
it('should have `your content here` x-large', () => {
|
||||
let subject = element(by.css('[x-large]')).getText();
|
||||
let result = 'Your Content Here';
|
||||
expect(subject).toEqual(result);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
import {
|
||||
it,
|
||||
inject,
|
||||
injectAsync,
|
||||
describe,
|
||||
beforeEachProviders,
|
||||
TestComponentBuilder
|
||||
} from 'angular2/testing';
|
||||
|
||||
import {Component, provide} from 'angular2/core';
|
||||
import {BaseRequestOptions, Http} from 'angular2/http';
|
||||
import {MockBackend} from 'angular2/http/testing';
|
||||
|
||||
// Load the implementations that should be tested
|
||||
import {Home} from './home.component';
|
||||
import {Title} from './title';
|
||||
import {AppState} from '../app.service';
|
||||
|
||||
describe('Home', () => {
|
||||
// provide our implementations or mocks to the dependency injector
|
||||
beforeEachProviders(() => [
|
||||
BaseRequestOptions,
|
||||
MockBackend,
|
||||
provide(Http, {
|
||||
useFactory: function(backend, defaultOptions) {
|
||||
return new Http(backend, defaultOptions);
|
||||
},
|
||||
deps: [MockBackend, BaseRequestOptions]
|
||||
}),
|
||||
|
||||
AppState,
|
||||
Title,
|
||||
Home
|
||||
]);
|
||||
|
||||
it('should have default data', inject([ Home ], (home) => {
|
||||
expect(home.localState).toEqual({ value: '' });
|
||||
}));
|
||||
|
||||
it('should have a title', inject([ Home ], (home) => {
|
||||
expect(!!home.title).toEqual(true);
|
||||
}));
|
||||
|
||||
it('should log ngOnInit', inject([ Home ], (home) => {
|
||||
spyOn(console, 'log');
|
||||
expect(console.log).not.toHaveBeenCalled();
|
||||
|
||||
home.ngOnInit();
|
||||
expect(console.log).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
import {
|
||||
it,
|
||||
inject,
|
||||
injectAsync,
|
||||
beforeEachProviders,
|
||||
TestComponentBuilder
|
||||
} from 'angular2/testing';
|
||||
|
||||
import {Component, provide} from 'angular2/core';
|
||||
import {BaseRequestOptions, Http} from 'angular2/http';
|
||||
import {MockBackend} from 'angular2/http/testing';
|
||||
|
||||
|
||||
import {Title} from './title.service';
|
||||
|
||||
describe('Title', () => {
|
||||
beforeEachProviders(() => [
|
||||
BaseRequestOptions,
|
||||
MockBackend,
|
||||
provide(Http, {
|
||||
useFactory: function(backend, defaultOptions) {
|
||||
return new Http(backend, defaultOptions);
|
||||
},
|
||||
deps: [MockBackend, BaseRequestOptions]
|
||||
}),
|
||||
|
||||
Title
|
||||
]);
|
||||
|
||||
|
||||
it('should have http', inject([ Title ], (title) => {
|
||||
expect(!!title.http).toEqual(true);
|
||||
}));
|
||||
|
||||
it('should get data from the server', inject([ Title ], (title) => {
|
||||
spyOn(console, 'log');
|
||||
expect(console.log).not.toHaveBeenCalled();
|
||||
|
||||
title.getData();
|
||||
expect(console.log).toHaveBeenCalled();
|
||||
expect(title.getData()).toEqual({ value: 'AngularClass' });
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
import {
|
||||
it,
|
||||
inject,
|
||||
injectAsync,
|
||||
describe,
|
||||
beforeEachProviders,
|
||||
TestComponentBuilder
|
||||
} from 'angular2/testing';
|
||||
|
||||
import {Component, provide} from 'angular2/core';
|
||||
import {BaseRequestOptions, Http} from 'angular2/http';
|
||||
import {MockBackend} from 'angular2/http/testing';
|
||||
|
||||
// Load the implementations that should be tested
|
||||
import {XLarge} from './x-large.directive';
|
||||
|
||||
describe('x-large directive', () => {
|
||||
// Create a test component to test directives
|
||||
@Component({
|
||||
template: '',
|
||||
directives: [ XLarge ]
|
||||
})
|
||||
class TestComponent {}
|
||||
|
||||
it('should sent font-size to x-large', injectAsync([TestComponentBuilder], (tcb) => {
|
||||
return tcb.overrideTemplate(TestComponent, '<div x-large>Content</div>')
|
||||
.createAsync(TestComponent).then((fixture: any) => {
|
||||
fixture.detectChanges();
|
||||
let compiled = fixture.debugElement.nativeElement.children[0];
|
||||
expect(compiled.style.fontSize).toBe('x-large');
|
||||
});
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
@ -4,12 +4,9 @@
|
|||
},
|
||||
"devDependencies": {},
|
||||
"ambientDependencies": {
|
||||
"angular-protractor": "github:DefinitelyTyped/DefinitelyTyped/angular-protractor/angular-protractor.d.ts#64b25f63f0ec821040a5d3e049a976865062ed9d",
|
||||
"core-js": "registry:dt/core-js#0.0.0+20160317120654",
|
||||
"hammerjs": "github:DefinitelyTyped/DefinitelyTyped/hammerjs/hammerjs.d.ts#74a4dfc1bc2dfadec47b8aae953b28546cb9c6b7",
|
||||
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#4b36b94d5910aa8a4d20bdcd5bd1f9ae6ad18d3c",
|
||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#8cf8164641be73e8f1e652c2a5b967c7210b6729",
|
||||
"selenium-webdriver": "github:DefinitelyTyped/DefinitelyTyped/selenium-webdriver/selenium-webdriver.d.ts#a83677ed13add14c2ab06c7325d182d0ba2784ea",
|
||||
"webpack": "github:DefinitelyTyped/DefinitelyTyped/webpack/webpack.d.ts#95c02169ba8fa58ac1092422efbd2e3174a206f4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,10 +8,6 @@ switch (process.env.NODE_ENV) {
|
|||
case 'production':
|
||||
module.exports = require('./config/webpack.prod');
|
||||
break;
|
||||
case 'test':
|
||||
case 'testing':
|
||||
module.exports = require('./config/webpack.test');
|
||||
break;
|
||||
case 'dev':
|
||||
case 'development':
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue