mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-02-28 02:30:52 +00:00
* Adjust update flow to not auto update, not publish in CI * Revert "Adjust update flow to not auto update, not publish in CI" This reverts commit 74fb382ce8d8cd9e227703ccfa8d6310bffd9dda. * First pass at new app version modal * Added app alpha notice that either warns you about alpha, or blocks the whole app. * Improve newer version detection, add unit tests * Remove native auto update behavior * Notice once per session * copy changes per PR review
77 lines
2.1 KiB
TypeScript
77 lines
2.1 KiB
TypeScript
import { objectContainsObjectKeys, isNewerVersion } from 'utils/helpers';
|
|
|
|
describe('objectContainsObjectKeys', () => {
|
|
it('should return true when object contains all keys of another object', () => {
|
|
const checkingObject = {
|
|
a: 1,
|
|
b: 2,
|
|
c: 3
|
|
};
|
|
|
|
const containingObject = {
|
|
a: 1,
|
|
b: 2,
|
|
c: 3,
|
|
d: 4
|
|
};
|
|
|
|
expect(objectContainsObjectKeys(checkingObject, containingObject)).toBeTruthy();
|
|
});
|
|
|
|
it('should return false when object does not contain all keys of another object', () => {
|
|
const checkingObject = {
|
|
a: 1,
|
|
b: 2,
|
|
c: 3
|
|
};
|
|
|
|
const containingObject = {
|
|
a: 1
|
|
};
|
|
|
|
expect(objectContainsObjectKeys(checkingObject, containingObject)).toBeFalsy();
|
|
});
|
|
});
|
|
|
|
describe('isNewerVersion', () => {
|
|
it('Should return true for newer major version', () => {
|
|
expect(isNewerVersion('1.0.0', '2.0.0')).toBeTruthy();
|
|
});
|
|
|
|
it('Should return true for newer minor version', () => {
|
|
expect(isNewerVersion('1.0.0', '1.1.0')).toBeTruthy();
|
|
});
|
|
|
|
it('Should return true for newer patch version', () => {
|
|
expect(isNewerVersion('1.0.0', '1.0.1')).toBeTruthy();
|
|
});
|
|
|
|
it('Should return false for same version', () => {
|
|
expect(isNewerVersion('1.0.0', '1.0.0')).toBeFalsy();
|
|
});
|
|
|
|
it('Should return false for older version', () => {
|
|
expect(isNewerVersion('1.0.1', '1.0.0')).toBeFalsy();
|
|
});
|
|
|
|
it('Should return true for newer release candidate', () => {
|
|
expect(isNewerVersion('1.0.0-RC.0', '1.0.0-RC.1')).toBeTruthy();
|
|
});
|
|
|
|
it('Should return false for same release candidate', () => {
|
|
expect(isNewerVersion('1.0.0-RC.1', '1.0.0-RC.1')).toBeFalsy();
|
|
});
|
|
|
|
it('Should return false for older release candidate', () => {
|
|
expect(isNewerVersion('1.0.0-RC.1', '1.0.0-RC.0')).toBeFalsy();
|
|
});
|
|
|
|
it('Should return true for same version, but no release candidate', () => {
|
|
expect(isNewerVersion('1.0.0-RC.999', '1.0.0')).toBeTruthy();
|
|
});
|
|
|
|
it('Should return true for newer non-release candidate', () => {
|
|
expect(isNewerVersion('1.0.0-RC.999', '1.0.1')).toBeTruthy();
|
|
});
|
|
});
|