describe('app', function() {
beforeEach(module('app'));
var bucketService;
beforeEach(inject(function (_bucketService_) {
bucketService = _bucketService_;
}));
describe('the bucket service', function() {
it('should return an empty bucket', function() {
bucketService.clearBucket();
expect(bucketService.bucketTotalItems()).toEqual(0);
});
it('should add to the bucket', function() {
bucketService.addToBucket({ id: 1, displayName: "water", temperature: "warm" });
expect(bucketService.bucketTotalItems()).toEqual(1);
});
it('should remove the item from the bucket by item object', function() {
bucketService.clearBucket();
bucketService.addToBucket({ id: 1, displayName: "water", temperature: "warm" });
bucketService.removeItemFromBasket({ id: 1, displayName: "water", temperature: "warm" });
expect(bucketService.bucketTotalItems()).toEqual(0);
});
it('should remove the item from the bucket by item id', function() {
bucketService.clearBucket();
bucketService.addToBucket({ id: 1, displayName: "water", temperature: "warm" });
bucketService.removeById(1);
expect(bucketService.bucketTotalItems()).toEqual(0);
});
}
});
// Karma configuration
// Generated on Mon Oct 03 2016 01:41:25 GMT+0100 (GMT Daylight Time)
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
'src/main/resources/static/libs/jquery.min.js',
'src/main/resources/static/libs/angular.js',
'src/main/resources/static/libs/angular-mocks.js',
'src/main/resources/static/libs/angular-route.min.js',
'src/main/resources/static/libs/angular-messages.min.js',
'src/main/resources/static/libs/angular-local-storage.min.js',
'src/main/resources/static/libs/angular-animate.min.js',
'src/main/resources/static/libs/ui-bootstrap-tpls.min.js',
'src/main/resources/static/js/app.module.js',
'src/main/resources/static/js/app.*.js',
'src/main/resources/static/js/services/*.service.js',
'src/main/resources/static/js/shared/*.directive.js',
'src/main/resources/static/js/**/*.controller.js',
'src/main/resources/static/js/**/*.spec.js'
],
plugins : [
'karma-jasmine',
'karma-chrome-launcher',
'karma-phantomjs-launcher'
],
// list of files to exclude
exclude: [
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
// 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_DEBUG,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
})
}