1
|
|
|
import { versionMatch } from '../../../src/utils/helpers/version'; |
2
|
|
|
|
3
|
|
|
describe('version', () => { |
4
|
|
|
describe('versionMatch', () => { |
5
|
|
|
it.each([ |
|
|
|
|
6
|
|
|
[ undefined, {}, false ], |
7
|
|
|
[ null, {}, false ], |
8
|
|
|
[ '', {}, false ], |
9
|
|
|
[[], {}, false ], |
10
|
|
|
[ '2.8.3', {}, true ], |
11
|
|
|
[ '2.8.3', { minVersion: '2.0.0' }, true ], |
12
|
|
|
[ '2.0.0', { minVersion: '2.0.0' }, true ], |
13
|
|
|
[ '1.8.0', { maxVersion: '1.8.0' }, true ], |
14
|
|
|
[ '1.7.1', { maxVersion: '1.8.0' }, true ], |
15
|
|
|
[ '1.7.3', { minVersion: '1.7.0', maxVersion: '1.8.0' }, true ], |
16
|
|
|
[ '1.8.3', { minVersion: '2.0.0' }, false ], |
17
|
|
|
[ '1.8.3', { maxVersion: '1.8.0' }, false ], |
18
|
|
|
[ '1.8.3', { minVersion: '1.7.0', maxVersion: '1.8.0' }, false ], |
19
|
|
|
])('properly matches versions based on what is provided', (version, versionConstraints, expected) => { |
20
|
|
|
expect(versionMatch(version, versionConstraints)).toEqual(expected); |
21
|
|
|
}); |
22
|
|
|
}); |
23
|
|
|
}); |
24
|
|
|
|
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.