You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import { addToCart, cart } from '../../data/cart.js';
describe('test suite: addToCart', () => {
it('adds and exisiting product to the cart', () => {
});
it('add a new product to the cart', () => {
spyOn(localStorage, 'getItem').and.callFake(() => {
return JSON.stringify({});
});
console.log(localStorage.getItem('cart'));
From - Lesson 16 (Testing)
Using Jasmine Testing Framework
The above lines of code is supposed to display an empty array in the console since the code is supposed to spyOn locaStorage('getItem')and call fake the cart array, but instead it's returning "null" in the console. I don't know where I went wrong. I need assistance, I have been trying to solve this issue for the past 3 days now.
Thanks.
The text was updated successfully, but these errors were encountered:
(https://github.com/SuperSimpleDev/javascript-course/assets/92880605/499f5d7c-b17c-4679-a0ad-25c9507c6d20
SCREENSHOT Above
CODE below
import { addToCart, cart } from '../../data/cart.js';
describe('test suite: addToCart', () => {
it('adds and exisiting product to the cart', () => {
});
it('add a new product to the cart', () => {
spyOn(localStorage, 'getItem').and.callFake(() => {
return JSON.stringify({});
});
console.log(localStorage.getItem('cart'));
});
});
From - Lesson 16 (Testing)
Using Jasmine Testing Framework
The above lines of code is supposed to display an empty array in the console since the code is supposed to spyOn locaStorage('getItem')and call fake the cart array, but instead it's returning "null" in the console. I don't know where I went wrong. I need assistance, I have been trying to solve this issue for the past 3 days now.
Thanks.
The text was updated successfully, but these errors were encountered: