ADD codepath for prereleases, they should not trigger a updateNotification

This commit is contained in:
Norbert de Langen 2019-10-23 21:07:19 +02:00
parent d49c1aab4b
commit 2c7b76e05c
2 changed files with 21 additions and 1 deletions

View File

@ -89,7 +89,9 @@ export default function({ store, mode }: Module) {
const diff = semver.diff(current.version, latest.version);
return semver.gt(latest.version, current.version) && diff !== 'patch';
return (
semver.gt(latest.version, current.version) && diff !== 'patch' && !diff.includes('pre')
);
}
return false;
},

View File

@ -239,5 +239,23 @@ describe('versions API', () => {
expect(api.versionUpdateAvailable()).toEqual(true);
});
it('new prerelease version', async () => {
const store = createMockStore();
const { api, init, state: initialState } = initVersions({ store });
await init({ api: { ...api, addNotification: jest.fn() } });
store.setState({
...initialState,
versions: {
...initialState.versions,
current: { version: '5.2.1' },
latest: { version: '6.2.1-prerelease.0' },
},
});
expect(api.versionUpdateAvailable()).toEqual(false);
});
});
});