1
0
mirror of https://github.com/lancedikson/bowser synced 2024-10-27 20:34:22 +00:00

Fix Travis Tests

This commit is contained in:
Robert Sandell 2018-12-30 10:18:58 +02:00
parent d9693088cc
commit 97d877f9c2
3 changed files with 20 additions and 20 deletions

View File

@ -69,7 +69,7 @@ export default [
const versionName = getAndroidVersionName(version); const versionName = getAndroidVersionName(version);
const os = { const os = {
name: 'Android', name: 'Android',
version version,
}; };
if (versionName) { if (versionName) {
os.versionName = versionName; os.versionName = versionName;

View File

@ -16,13 +16,13 @@ export default [
{ {
test: [/huawei/i], test: [/huawei/i],
describe(ua) { describe(ua) {
const model = getFirstMatch(/(can\-l01)/i, ua) && "Nova"; const model = getFirstMatch(/(can-l01)/i, ua) && 'Nova';
const platform = { const platform = {
type: TYPES_LABELS.mobile, type: TYPES_LABELS.mobile,
vendor: 'Huawei' vendor: 'Huawei',
}; };
if (model) { if (model) {
platform.model = model; platform.model = model;
} }
return platform; return platform;
}, },

View File

@ -76,24 +76,24 @@ class Utils {
* @return {string} versionName * @return {string} versionName
*/ */
static getAndroidVersionName(version) { static getAndroidVersionName(version) {
const v = version.split('.').splice(0, 2).map(function(s) { const v = version.split('.').splice(0, 2).map((s) => {
return parseInt(s) || 0; return parseInt(s, 10) || 0;
}); });
v.push(0); v.push(0);
if (v[0] == 1 && v[1] < 5) return undefined; if (v[0] === 1 && v[1] < 5) return undefined;
if (v[0] == 1 && v[1] < 6) return "Cupcake"; if (v[0] === 1 && v[1] < 6) return "Cupcake";
if (v[0] == 1 && v[1] >= 6) return "Donut"; if (v[0] === 1 && v[1] >= 6) return "Donut";
if (v[0] == 2 && v[1] < 2) return "Eclair"; if (v[0] === 2 && v[1] < 2) return "Eclair";
if (v[0] == 2 && v[1] == 2) return "Froyo"; if (v[0] === 2 && v[1] === 2) return "Froyo";
if (v[0] == 2 && v[1] > 2) return "Gingerbread"; if (v[0] === 2 && v[1] > 2) return "Gingerbread";
if (v[0] == 3) return "Honeycomb"; if (v[0] === 3) return "Honeycomb";
if (v[0] == 4 && v[1] < 1) return "Ice Cream Sandwich"; if (v[0] === 4 && v[1] < 1) return "Ice Cream Sandwich";
if (v[0] == 4 && v[1] < 4) return "Jelly Bean"; if (v[0] === 4 && v[1] < 4) return "Jelly Bean";
if (v[0] == 4 && v[1] >= 4) return "KitKat"; if (v[0] === 4 && v[1] >= 4) return "KitKat";
if (v[0] == 5) return "Lollipop"; if (v[0] === 5) return "Lollipop";
if (v[0] == 6) return "Marshmallow"; if (v[0] === 6) return "Marshmallow";
if (v[0] == 7) return "Nougat"; if (v[0] === 7) return "Nougat";
if (v[0] == 8) return "Oreo"; if (v[0] === 8) return "Oreo";
return undefined; return undefined;
} }