63 lines
2.4 KiB
JavaScript
63 lines
2.4 KiB
JavaScript
|
'use strict';
|
||
|
|
||
|
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
|
||
|
|
||
|
jest.mock('analytics-node');
|
||
|
jest.mock('fs');
|
||
|
jest.mock('../Env');
|
||
|
jest.mock('request');
|
||
|
|
||
|
const request = require('request');
|
||
|
const Versions = require('../Versions');
|
||
|
|
||
|
request.__setMockResponse({
|
||
|
body: {
|
||
|
iosVersion: '1.6.0',
|
||
|
androidVersion: '1.6.0',
|
||
|
sdkVersions: {
|
||
|
'5.0.0': {
|
||
|
expoReactNativeTag: 'sdk-5.0.0',
|
||
|
facebookReactNativeVersion: '0.24.0'
|
||
|
},
|
||
|
'6.0.0': {
|
||
|
expoReactNativeTag: 'sdk-6.0.0',
|
||
|
facebookReactNativeVersion: '0.27.0'
|
||
|
},
|
||
|
'7.0.0': {
|
||
|
expoReactNativeTag: 'sdk-7.0.0',
|
||
|
facebookReactNativeVersion: '0.27.0'
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
describe('facebookReactNativeVersionsAsync', () => {
|
||
|
it('checks list of versions is correct', _asyncToGenerator(function* () {
|
||
|
let facebookReactNativeVersions = yield Versions.facebookReactNativeVersionsAsync();
|
||
|
expect(facebookReactNativeVersions).toEqual(['0.24.0', '0.27.0']);
|
||
|
}));
|
||
|
});
|
||
|
|
||
|
describe('facebookReactNativeVersionToExpoVersionAsync', () => {
|
||
|
it('returns expo version when available', _asyncToGenerator(function* () {
|
||
|
let expoVersion = yield Versions.facebookReactNativeVersionToExpoVersionAsync('0.24.0');
|
||
|
expect(expoVersion).toEqual('5.0.0');
|
||
|
}));
|
||
|
|
||
|
it('returns newest expo version when multiple versions exist', _asyncToGenerator(function* () {
|
||
|
let expoVersion = yield Versions.facebookReactNativeVersionToExpoVersionAsync('0.27.0');
|
||
|
expect(expoVersion).toEqual('7.0.0');
|
||
|
}));
|
||
|
|
||
|
it('ignores patch version', _asyncToGenerator(function* () {
|
||
|
let expoVersion = yield Versions.facebookReactNativeVersionToExpoVersionAsync('0.27.3');
|
||
|
expect(expoVersion).toEqual('7.0.0');
|
||
|
}));
|
||
|
|
||
|
it('returns null when no matching version exists', _asyncToGenerator(function* () {
|
||
|
let expoVersion = yield Versions.facebookReactNativeVersionToExpoVersionAsync('0.23.0');
|
||
|
expect(expoVersion).toEqual(null);
|
||
|
}));
|
||
|
});
|
||
|
//# sourceMappingURL=../__sourcemaps__/__tests__/Versions-test.js.map
|