diff --git a/project-manager/karma.conf.js b/project-manager/karma.conf.js new file mode 100644 index 0000000..db3850a --- /dev/null +++ b/project-manager/karma.conf.js @@ -0,0 +1,75 @@ +// Karma configuration +// Generated on Sat Mar 25 2017 06:31:51 GMT+0100 (CET) + +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/**/*.spec.ts' + ], + + + // list of files to exclude + exclude: [ + ], + + + // redefine default mapping from file extensions to MIME-type + // set property name to required MIME, provide Array of extensions (without dots) as it's value + mime: { + 'text/x-typescript': ['ts'] + }, + + // 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_INFO, + + + // 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 + }) +} diff --git a/project-manager/src/app/blog/blog.component.spec.ts b/project-manager/src/app/blog/blog.component.spec.ts deleted file mode 100644 index e067a7b..0000000 --- a/project-manager/src/app/blog/blog.component.spec.ts +++ /dev/null @@ -1,13 +0,0 @@ -describe("Blog Component", () => { - - it("should succeed on basic logic check", () => { - expect(1+1).toEqual(2); - expect(true).toBe(true) - }) - - it("should fail on basic logic check error", () => { - expect(1+1).toEqual(2); - expect(true).toBe(false) - }) - -}) diff --git a/project-manager/src/app/test-example/basic-test.spec.ts b/project-manager/src/app/test-example/basic-test.spec.ts new file mode 100644 index 0000000..c9fe75a --- /dev/null +++ b/project-manager/src/app/test-example/basic-test.spec.ts @@ -0,0 +1,34 @@ +// Test Suite +describe('Basic test', () => { + + // Variablendeklaration zur Verwendung in mehreren Testfällen + let someInt; + + // Methode wird vor jedem Testfall ausgeführt + beforeEach(() => { + someInt = 2; + }); + + // Testfall + it('should succeed on fundamental matchers', () => { + expect(1+1).toBe(2) + expect(null).toEqual(null); + expect('Hello world').toContain('Hello'); + expect(true).toBeTruthy(); + expect(false).toBeFalsy(); + expect(null).toBeNull(); + expect(undefined).toBeUndefined(); + expect('angular.txt').toMatch(/\w+.(txt)/); + expect('World').not.toContain('Hello'); + }); + + it('someInt should have value from beforeEach', () => { + expect(someInt).toBe(2); + someInt = 20; + }); + + it('someInt should have overwritten value from beforeEach', () => { + expect(someInt).toBe(2); + }); + +});