Skip to content

Commit

Permalink
Try again
Browse files Browse the repository at this point in the history
  • Loading branch information
xander-marjoram committed Apr 25, 2024
1 parent c3c1635 commit e8c5337
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ describe('`general.services`', () => {
};
}());

Object.defineProperty(window, 'localStorage', { value: localStorage });
Object.defineProperty(global.window, 'localStorage', { value: localStorage });
});

it('should exist', () => {
Expand All @@ -237,7 +237,7 @@ describe('`general.services`', () => {
describe('AND window.localStorage exists', () => {
it('should call `setItem` with the given `key` & value', () => {
// Arrange
const spy = jest.spyOn(window.localStorage, 'setItem');
const spy = jest.spyOn(global.window.localStorage, 'setItem');

// Act
generalServices.fullAddressLocalStorageService.setItem('key', { city: 'london' });
Expand All @@ -258,7 +258,7 @@ describe('`general.services`', () => {
describe('AND window.localStorage exists', () => {
it('should call `getItem` with the given `key`', () => {
// Arrange
const spy = jest.spyOn(window.localStorage, 'getItem');
const spy = jest.spyOn(global.window.localStorage, 'getItem');

// Act
generalServices.fullAddressLocalStorageService.getItem('key');
Expand All @@ -269,7 +269,7 @@ describe('`general.services`', () => {

it('should return an item when the key exists in localStorage', () => {
// Arrange
jest.spyOn(window.localStorage, 'getItem');
jest.spyOn(global.window.localStorage, 'getItem');

// Act
const result = generalServices.fullAddressLocalStorageService.getItem('key');
Expand All @@ -280,7 +280,7 @@ describe('`general.services`', () => {

it('should return false when the key does NOT exists in localStorage', () => {
// Arrange
jest.spyOn(window.localStorage, 'getItem');
jest.spyOn(global.window.localStorage, 'getItem');

// Act
const result = generalServices.fullAddressLocalStorageService.getItem('non-existing-key');
Expand All @@ -301,7 +301,7 @@ describe('`general.services`', () => {
describe('AND window.localStorage exists', () => {
it('should call `removeItem` with the given `key`', () => {
// Arrange
const spy = jest.spyOn(window.localStorage, 'removeItem');
const spy = jest.spyOn(global.window.localStorage, 'removeItem');

// Act
generalServices.fullAddressLocalStorageService.removeItem('key');
Expand Down

0 comments on commit e8c5337

Please sign in to comment.