-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
182 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { async, TestBed, inject } from '@angular/core/testing'; | ||
import { IonicModule } from "ionic-angular/index"; | ||
import { ConversionService } from './conversion-service'; | ||
|
||
describe('MyApp Component', () => { | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [], | ||
imports: [ | ||
], | ||
providers: [ | ||
ConversionService | ||
] | ||
}) | ||
})); | ||
|
||
describe('feetToInches', () => { | ||
it('should convert feet to inches', inject([ConversionService], (ConversionService) => { | ||
expect(ConversionService.feetToInches(5)).toBe(60); | ||
})); | ||
}); | ||
|
||
describe('cmToInches', () => { | ||
it('should convert cm to inches', inject([ConversionService], (ConversionService) => { | ||
expect(ConversionService.cmToInches(3)).toBe(7.62); | ||
})); | ||
}); | ||
|
||
describe('lbsToKg', () => { | ||
it('should convert lbs to kgs', inject([ConversionService], (ConversionService) => { | ||
expect(ConversionService.lbsToKg(210)).toBe('95.25'); | ||
})); | ||
}); | ||
|
||
describe('metresToInches', () => { | ||
it('should convert metres to inches', inject([ConversionService], (ConversionService) => { | ||
expect(ConversionService.metresToInches(10)).toBe('393.70'); | ||
})); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Error.stackTraceLimit = Infinity; | ||
|
||
require('core-js/es6'); | ||
require('core-js/es7/reflect'); | ||
|
||
require('zone.js/dist/zone'); | ||
require('zone.js/dist/long-stack-trace-zone'); | ||
require('zone.js/dist/proxy'); | ||
require('zone.js/dist/sync-test'); | ||
require('zone.js/dist/jasmine-patch'); | ||
require('zone.js/dist/async-test'); | ||
require('zone.js/dist/fake-async-test'); | ||
|
||
var appContext = require.context('../src', true, /\.spec\.ts/); | ||
|
||
appContext.keys().forEach(appContext); | ||
|
||
var testing = require('@angular/core/testing'); | ||
var browser = require('@angular/platform-browser-dynamic/testing'); | ||
|
||
testing.TestBed.initTestEnvironment(browser.BrowserDynamicTestingModule, browser.platformBrowserDynamicTesting()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
var webpackConfig = require('./webpack.test.js'); | ||
|
||
module.exports = function (config) { | ||
var _config = { | ||
basePath: '', | ||
|
||
frameworks: ['jasmine'], | ||
|
||
files: [ | ||
{pattern: './karma-test-shim.js', watched: true} | ||
], | ||
|
||
preprocessors: { | ||
'./karma-test-shim.js': ['webpack', 'sourcemap'] | ||
}, | ||
|
||
webpack: webpackConfig, | ||
|
||
webpackMiddleware: { | ||
stats: 'errors-only' | ||
}, | ||
|
||
webpackServer: { | ||
noInfo: true | ||
}, | ||
|
||
reporters: ['kjhtml', 'dots'], | ||
port: 9876, | ||
colors: true, | ||
logLevel: config.LOG_INFO, | ||
autoWatch: true, | ||
browsers: ['Chrome'], | ||
singleRun: false | ||
}; | ||
|
||
config.set(_config); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
var webpack = require('webpack'); | ||
var path = require('path'); | ||
|
||
module.exports = { | ||
devtool: 'inline-source-map', | ||
|
||
resolve: { | ||
extensions: ['.ts', '.js'] | ||
}, | ||
|
||
module: { | ||
rules: [ | ||
{ | ||
test: /\.ts$/, | ||
loaders: [ | ||
{ | ||
loader: 'ts-loader' | ||
} , 'angular2-template-loader' | ||
] | ||
}, | ||
{ | ||
test: /\.html$/, | ||
loader: 'html-loader' | ||
}, | ||
{ | ||
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/, | ||
loader: 'null-loader' | ||
} | ||
] | ||
}, | ||
|
||
plugins: [ | ||
new webpack.ContextReplacementPlugin( | ||
// The (\\|\/) piece accounts for path separators in *nix and Windows | ||
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/, | ||
root('./src'), // location of your src | ||
{} // a map of your routes | ||
) | ||
] | ||
}; | ||
|
||
function root(localPath) { | ||
return path.resolve(__dirname, localPath); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters