Hi I am new to testing with karma Jasmine. I was trying to create a new scope with controller.$rootScope.$new(); or even just plain $rootScope.$new(); but I get an error
TypeError: Cannot read property '$new' of undefined
Here is the relevant code code in the describe block toggle options button I am getting the error (that is the only code I have added besides for injecting rootscope)
fdescribe('Online Statements', () => {
const module = window.module;
const inject = window.inject;
beforeEach(module('wbbUiApp'));
describe('Controller', () => {
let scope;
let controller;
let injectibles;
let bindings;
const createController = userDetails => {
inject(($componentController,
$window,
$filter,
$rootScope) => {
// The same `$inject` array values listed in `account-activity.controller.js`
injectibles = {
$window,
$filter,
$rootScope
};
// The same bindings listed in `account-activity.component.js`
bindings = {
accountDetails
};
controller = $componentController('onlineStatements', injectibles, bindings);
});
};
describe('toggle options button', () => {
it('should set the scope value to the index', () => {
scope = controller.$rootScope.$new(); // problem here
const index = 1;
controller.toggleOptions(index)
expect(scope.activeRow).toEqual(index)
})
})
});
this might be something simple as I am just starting. Thank you in advance.