fix: bump version to 1.0.9.4, update changelog

This commit is contained in:
kitbyte
2026-07-22 00:03:38 +03:00
parent e7c7beb621
commit 643c8f8b62
38 changed files with 788 additions and 365 deletions
+21 -3
View File
@@ -1,9 +1,10 @@
import { beforeEach, describe, expect, it } from 'vitest';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { loadStringSet, saveStringSet } from './storage';
describe('storage revival', () => {
beforeEach(() => localStorage.clear());
afterEach(() => vi.restoreAllMocks());
it('revives only valid string ids', () => {
localStorage.setItem('pins', JSON.stringify(['one', '', 2, 'two']));
@@ -11,9 +12,26 @@ describe('storage revival', () => {
});
it('removes empty sets', () => {
saveStringSet('pins', { one: true });
expect(saveStringSet('pins', { one: true })).toBe(true);
expect(localStorage.getItem('pins')).toBe(JSON.stringify(['one']));
saveStringSet('pins', {});
expect(saveStringSet('pins', {})).toBe(true);
expect(localStorage.getItem('pins')).toBeNull();
});
it('reports a failed browser storage write', () => {
vi.spyOn(Storage.prototype, 'setItem').mockImplementation(() => {
throw new DOMException('Storage disabled', 'SecurityError');
});
expect(saveStringSet('pins', { one: true })).toBe(false);
});
it('handles browsers that block access to local storage', () => {
vi.spyOn(window, 'localStorage', 'get').mockImplementation(() => {
throw new DOMException('Storage disabled', 'SecurityError');
});
expect(saveStringSet('pins', { one: true })).toBe(false);
expect(loadStringSet('pins')).toEqual({});
});
});