mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
test: refactor electron window handling in PlaylistsService tests
This commit is contained in:
1 parent
ce2dad2dec
commit
4b4d0abfab
2 files changed
+9
-8
No files matched your search
@@ -7,10 +7,11 @@ const STALKER_PLAYLIST_METADATA_MIGRATION_FLAG =
|
||||
'm3u-playlists-stalker-metadata-v1';
|
||||
|
||||
describe('PlaylistsService', () => {
|
||||
const originalElectron = (window as Window & { electron?: unknown }).electron;
|
||||
const testWindow = window as unknown as { electron?: unknown };
|
||||
const originalElectron = testWindow.electron;
|
||||
|
||||
afterEach(() => {
|
||||
(window as Window & { electron?: unknown }).electron = originalElectron;
|
||||
testWindow.electron = originalElectron;
|
||||
localStorage.removeItem(STALKER_PLAYLIST_METADATA_MIGRATION_FLAG);
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
@@ -73,7 +74,7 @@ describe('PlaylistsService', () => {
|
||||
);
|
||||
}),
|
||||
};
|
||||
(window as Window & { electron?: unknown }).electron = electron;
|
||||
testWindow.electron = electron;
|
||||
|
||||
const service = createService();
|
||||
|
||||
@@ -110,7 +111,7 @@ describe('PlaylistsService', () => {
|
||||
dbUpsertAppPlaylist: jest.fn(),
|
||||
dbUpsertAppPlaylists: jest.fn(),
|
||||
};
|
||||
(window as Window & { electron?: unknown }).electron = electron;
|
||||
testWindow.electron = electron;
|
||||
|
||||
const service = createService();
|
||||
|
||||
@@ -146,7 +147,7 @@ describe('PlaylistsService', () => {
|
||||
return of(playlist);
|
||||
}),
|
||||
};
|
||||
(window as Window & { electron?: unknown }).electron = undefined;
|
||||
testWindow.electron = undefined;
|
||||
|
||||
const service = createService(dbService);
|
||||
|
||||
@@ -186,7 +187,7 @@ describe('PlaylistsService', () => {
|
||||
of(playlist)
|
||||
),
|
||||
};
|
||||
(window as Window & { electron?: unknown }).electron = undefined;
|
||||
testWindow.electron = undefined;
|
||||
|
||||
const service = createService(dbService);
|
||||
|
||||
@@ -226,7 +227,7 @@ describe('PlaylistsService', () => {
|
||||
of(playlist)
|
||||
),
|
||||
};
|
||||
(window as Window & { electron?: unknown }).electron = undefined;
|
||||
testWindow.electron = undefined;
|
||||
|
||||
const service = createService(dbService);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"types": ["jest", "node"],
|
||||
"moduleResolution": "bundler"
|
||||
},
|
||||
"files": ["src/test-setup.ts"],
|
||||
"files": ["src/test-setup.ts", "../../global.d.ts"],
|
||||
"include": [
|
||||
"jest.config.ts",
|
||||
"src/**/*.test.ts",
|
||||
|
||||
Reference in new issue
Block a user