Hi,
1.) karma.conf.js:
// list of files / patterns to load in the browser
files: [
'app_frontend/bower_components/angular/angular.js',
'app_frontend/bower_components/angular-cookies/angular-cookies.js',
'node_modules/angular-mocks/angular-mocks.js',
'app_frontend/bower_components/angular-resource/angular-resource.js',
...
],
2.) dataServer.service.spec.ts (TypeScript):
/// <reference path="../../../typings/globals/jasmine/index.d.ts" />
/// <reference path="../../../typings/globals/jquery/index.d.ts" />
/// <reference path="../../../typings/globals/angular/index.d.ts" />
declare var module;
declare var inject;
namespace SW.DataServer
{
describe( 'APIRequest', function ()
{
let dataServerService;
beforeEach( module( "SW.DataServer" ) );
//beforeEach( inject( function ( $injector )
//{
// debugger;
// dataServerService = $injector.get('DataServerService');
//}) );
beforeEach( inject( function ( $cookies, DataServerService )
{
debugger;
dataServerService = DataServerService;
}) );
it( 'GetInventoryExtendedInfo method should return correct data',
function ()
{
debugger;
fail( 'test' );
// dataServerService.APIRequest( 'Core',
'GetInventoryExtendedInfo',
// {
// ids: null,
// userIds: null,
// onlyComputers: false
// },
// function ( response )
// {
// console.log( response );
// expect( response ).not.toBe( null );
// },
// function ( response )
// {
// fail( 'Callback error.' );
// });
});
});
}
3.) karma start karma.conf.js --browsers=chrome --single-run=false
JS console error:
*Uncaught Error: [$injector:unpr] Unknown provider: $cookiesProvider <-
$cookies*
*http://errors.angularjs.org/1.5.8/$injector/unpr?p0=%24cookiesProvider%20%3C-%20%24cookies*
* at
http://localhost:9876/base/app_frontend/bower_components/angular/angular.js:68:12*
* at
http://localhost:9876/base/app_frontend/bower_components/angular/angular.js:4511:19*
* at Object.getService [as get]
(http://localhost:9876/base/app_frontend/bower_components/angular/angular.js:4664:39)*
* at
http://localhost:9876/base/app_frontend/bower_components/angular/angular.js:4516:45*
* at getService
(http://localhost:9876/base/app_frontend/bower_components/angular/angular.js:4664:39)*
* at injectionArgs
(http://localhost:9876/base/app_frontend/bower_components/angular/angular.js:4688:58)*
* at Object.invoke
(http://localhost:9876/base/app_frontend/bower_components/angular/angular.js:4710:18)*
* at Object.workFn
(http://localhost:9876/base/node_modules/angular-mocks/angular-mocks.js:3085:20)*
*Error: Declaration Location*
* at window.inject.angular.mock.inject
(http://localhost:9876/base/node_modules/angular-mocks/angular-mocks.js:3047:25)*
* at Suite.<anonymous>
(http://localhost:9876/base/app_frontend/common/dataServer/dataServer.service.spec.js:16:24)*
* at SW.DataServer.SW.DataServer
(http://localhost:9876/base/app_frontend/common/dataServer/dataServer.service.spec.js:8:9)*
* at SW
(http://localhost:9876/base/app_frontend/common/dataServer/dataServer.service.spec.js:40:7)*
* at
http://localhost:9876/base/app_frontend/common/dataServer/dataServer.service.spec.js:41:3*
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.