Skip to content

Commit 54aefec

Browse files
committed
Merge branch 'create-global-toggle-criticality-#1674' into add-ims-job-scheduler-api-url-to-config-#1676
2 parents ce775ef + c83d289 commit 54aefec

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/common/storage.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createBooleanLocalStorage } from './storage';
22

3-
describe('isAdminModeStorage', () => {
4-
const isAdminModeStorage = createBooleanLocalStorage('test');
3+
describe('createBooleanLocalStorage', () => {
4+
const testBooleanStorage = createBooleanLocalStorage('test');
55
const localStorageGetItemMock = vi.spyOn(
66
window.localStorage.__proto__,
77
'getItem'
@@ -28,7 +28,7 @@ describe('isAdminModeStorage', () => {
2828
it('should return true when stored value is "true"', () => {
2929
localStorageGetItemMock.mockImplementationOnce(() => 'true');
3030

31-
const result = isAdminModeStorage.load();
31+
const result = testBooleanStorage.load();
3232

3333
expect(result).toBe(true);
3434
expect(localStorageGetItemMock).toHaveBeenCalledWith(KEY);
@@ -37,45 +37,45 @@ describe('isAdminModeStorage', () => {
3737
it('should return false when stored value is "false"', () => {
3838
localStorageGetItemMock.mockImplementationOnce(() => 'false');
3939

40-
const result = isAdminModeStorage.load();
40+
const result = testBooleanStorage.load();
4141

4242
expect(result).toBe(false);
4343
});
4444

4545
it('should return undefined when value is missing', () => {
4646
localStorageGetItemMock.mockImplementationOnce(() => null);
4747

48-
const result = isAdminModeStorage.load();
48+
const result = testBooleanStorage.load();
4949

5050
expect(result).toBeUndefined();
5151
});
5252

5353
it('should return undefined for an invalid value', () => {
5454
localStorageGetItemMock.mockImplementationOnce(() => 'garbage');
5555

56-
const result = isAdminModeStorage.load();
56+
const result = testBooleanStorage.load();
5757

5858
expect(result).toBeUndefined();
5959
});
6060
});
6161

6262
describe('save', () => {
6363
it('should store "true"', () => {
64-
isAdminModeStorage.save(true);
64+
testBooleanStorage.save(true);
6565

6666
expect(localStorageSetItemMock).toHaveBeenCalledWith(KEY, 'true');
6767
});
6868

6969
it('should store "false"', () => {
70-
isAdminModeStorage.save(false);
70+
testBooleanStorage.save(false);
7171

7272
expect(localStorageSetItemMock).toHaveBeenCalledWith(KEY, 'false');
7373
});
7474
});
7575

7676
describe('clear', () => {
7777
it('should remove the key from localStorage', () => {
78-
isAdminModeStorage.clear();
78+
testBooleanStorage.clear();
7979

8080
expect(localStorageRemoveItemMock).toHaveBeenCalledWith(KEY);
8181
});

0 commit comments

Comments
 (0)