Questions tagged [jasmine2.0]
Jasmine is an open source testing framework for JavaScript. It aims to run on any JavaScript-enabled platform, to not intrude on the application nor the IDE, and to have easy-to-read syntax. It is heavily influenced by other unit testing frameworks, such as ScrewUnit, JSSpec, JSpec, and RSpec.
jasmine2.0
197
questions
1
vote
1
answer
2k
views
How to write unit test case of ag agrid cellRenderer with return value in angular
TS:
columnDefs = [
{ headerName: 'columnone', field: 'one', width: 120, sortable: true,
cellRenderer: (data) => {
return this.limitCommonUtil.numberFormatter(data?.data?.upperAmount);
...
1
vote
1
answer
563
views
How can I test that a function was called inside an if statement in jasmine-karma
I'm creating an Angular app and I'm learning unit test and I want to test certain method, but I can't manage to test that the function enters in the if statement. I don't know how to force it. Could ...
1
vote
0
answers
45
views
How to pass global variable into one test suite that has 3 test cases
I am trying to verify the delete functionality works as expected, so I am at the same test case creating a post and get its postId then delete it and lastly verify the postId does not found .
it('...
-1
votes
1
answer
73
views
Jasmine - JavaScript: How to check array response by validating one of the array returned data?
What if I want to validate a result from an array response!
Response:
({ id: '612d56952ca01806398dac1f', lastUpdated: '2021-08-30T22:07:17.099Z', userToken: 'public', data: Object({ createdOn: '2021-...
0
votes
0
answers
165
views
Stub out component private method
Jasmine can be used to spy on private methods.
Can you use Jasmine to stub out a private method in an Angular component? The pattern I am using spies on specific providers - not components.
Can you ...
1
vote
0
answers
506
views
Jasmine , Karma - Ignore ids from result object while comparison using toEqual
I am writing some test cases for a function that takes in an input and provides a modified output object.
My mock response is :-
mockResponse = {
"id":1,
"value":23,
...
1
vote
1
answer
2k
views
Failed: Invalid provider for the NgModule 'DynamicTestModule' - only instances of Provider and Type are allowed, got: [[object Object]?]
So there's this delightful error that's the very definition of annoying
this is the describe method:
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ MapMap ],
imports: ...
0
votes
1
answer
88
views
protractor-jasmine2-screenshot-reporter blank screenshot
Protractor config file have 2 reporting custom report for logging and other one is protractor-
jasmine2-screenshot-reporter. Screenshot png is generate but blank white screen only dispalyed.
Below ...
1
vote
1
answer
1k
views
Angular karma can't capture browser after updating angular 9 to 10
I followed the guide on the angular update giude to update my project from version 9 to 10. My project and my karma tests ran perfectly fine with angular 9. The update changed the TypeScript version ...
1
vote
1
answer
457
views
Protractor exited with error code 100 when run config.js
A few days ago, my protractor was working fine. But yesterday when I tried to run the same tests, I got:
E/launcher - Error: Error: Cannot find module 'jasmine-reporters'
Require stack:
- D:\Repos\POS\...
2
votes
0
answers
488
views
How to test Observable subscribe callback using jasmine?
I have an Angular9, Angular Material table similar to the ones in the docs.
https://material.angular.io/components/table/examples
The difference in my case is that I implemented a constructor in the ...
0
votes
1
answer
58
views
AngularJS - Jasmine - Cannot test Service in Controller callback function
I need help with Jasmine test.
I have this controller with a simple service:
angular.module('${project.name}')
.controller('MyControllerCtrl', function ($scope, InvocationService) {
$scope.vm = {...
0
votes
2
answers
58
views
Protractor POM method is not recognizing
spec.js
describe('Testing an animal adoption flow using page object', function() {
beforeEach(function() {
browser.get('http://www.thetestroom.com/jswebapp/index.html');
});
...
0
votes
0
answers
137
views
Function to left rotate a given array item n position to left - JavaScript
I'm doing some exercises on JavaScript and I came into a question that asks to rotate arrays item to the left with a given n rotation steps. The exercises are tested with Jasmine. Tried several method ...
1
vote
1
answer
1k
views
Webpack directory appended at error after migrating to Angular9
I've recently upgraded my projet from angular 7 to angular 9.
When I run the tests (ng test), I always get http://localhost:9876/_karma_webpack_/ appendend to the error, hence in visual studio code, ...