diff --git a/test/karma.conf.js b/test/karma.conf.js new file mode 100644 index 0000000..379b976 --- /dev/null +++ b/test/karma.conf.js @@ -0,0 +1,34 @@ +module.exports = function(config){ + config.set({ + + basePath : '../', + + files : [ + 'bower_components/angular/angular.js', + 'bower_components/angular-route/angular-route.js', + 'bower_components/angular-mocks/angular-mocks.js', + 'js/**/*.js', + 'test/unit/**/*.js' + ], + + autoWatch : true, + + frameworks: ['jasmine'], + + browsers : ['PhantomJS'], + + singleRun: true, + + plugins : [ + 'karma-phantomjs-launcher', + 'karma-jasmine', + 'karma-junit-reporter' + ], + + junitReporter : { + outputFile: 'test_out/unit.xml', + suite: 'unit' + } + + }); +}; diff --git a/test/unit/plugins.js b/test/unit/plugins.js new file mode 100644 index 0000000..3f35d69 --- /dev/null +++ b/test/unit/plugins.js @@ -0,0 +1,29 @@ +/* plugins go here */ + +var msg = function(msg) { + return {'text': msg } +} + +var metadata_name = function(message) { + return message['metadata'][0]['name'] +} + +describe('filter', function() { + beforeEach(module('plugins')); + + + describe('Plugins', function() { + beforeEach(module(function($provide) { + $provide.value('version', 'TEST_VER'); + })); + + + it('should recognize youtube videos', inject(function(plugins) { + expect( + metadata_name( + plugins.PluginManager.contentForMessage(msg('https://www.youtube.com/watch?v=dQw4w9WgXcQ')) + ) + ).toEqual('YouTube video'); + })); + }); +});