mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-05-29 19:10:46 +00:00
331fe8db39
This is a follow-up of https://github.com/nativefier/nativefier/pull/1162#discussion_r623766247
PR #1162 introduced a new `generateRandomSuffix` helper function,
used it for its needs (avoiding collisions of injected js/css).
But it also replaced existing appname normalizing logic with it,
introducing randomness in a place that used to be deterministic.
As a result, starting with dd6e15fb5
/ v43.1.0, re-creating an app would cause
the app to use a different appName, thus a different appData folder, thus
losing user data including cookies.
This PR leaves the `--inject` fixes of #1176, but reverts the appName logic
to the pre-#1176 code.
12 lines
495 B
TypeScript
12 lines
495 B
TypeScript
import { normalizeAppName } from './prepareElectronApp';
|
|
|
|
describe('normalizeAppName', () => {
|
|
test('it is stable', () => {
|
|
// Non-determinism / unstability would cause using a different appName
|
|
// at each app regen, thus a different appData folder, which would cause
|
|
// losing user state, including login state through cookies.
|
|
const normalizedTrello = normalizeAppName('Trello', 'https://trello.com');
|
|
expect(normalizedTrello).toBe('trello-nativefier-679e8e');
|
|
});
|
|
});
|