From d9693088ccbb44bab51924253599c070ab2df482 Mon Sep 17 00:00:00 2001 From: Robert Sandell Date: Sun, 30 Dec 2018 10:10:33 +0200 Subject: [PATCH] Fix tests --- src/parser-os.js | 2 +- src/utils.js | 3 ++- test/acceptance/useragentstrings.yml | 10 ++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/parser-os.js b/src/parser-os.js index d48e61a..af562ca 100644 --- a/src/parser-os.js +++ b/src/parser-os.js @@ -72,7 +72,7 @@ export default [ version }; if (versionName) { - os.versionName = versionName; + os.versionName = versionName; } return os; }, diff --git a/src/utils.js b/src/utils.js index 65895b4..2462284 100644 --- a/src/utils.js +++ b/src/utils.js @@ -78,7 +78,8 @@ class Utils { static getAndroidVersionName(version) { const v = version.split('.').splice(0, 2).map(function(s) { return parseInt(s) || 0; - }).push(0); + }); + v.push(0); 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 "Donut"; diff --git a/test/acceptance/useragentstrings.yml b/test/acceptance/useragentstrings.yml index 71047d2..bc1d4c7 100644 --- a/test/acceptance/useragentstrings.yml +++ b/test/acceptance/useragentstrings.yml @@ -1944,6 +1944,7 @@ os: name: "Android" version: "4.4.2" + versionName: "KitKat" platform: type: "tablet" vendor: "Nexus" @@ -1959,6 +1960,7 @@ os: name: "Android" version: "4.3" + versionName: "Jelly Bean" platform: type: "mobile" vendor: "Nexus" @@ -1974,6 +1976,7 @@ os: name: "Android" version: "4.2" + versionName: "Jelly Bean" platform: type: "tablet" vendor: "Nexus" @@ -1989,6 +1992,7 @@ os: name: "Android" version: "3.2" + versionName: "Honeycomb" platform: type: "tablet" engine: @@ -2003,6 +2007,7 @@ os: name: "Android" version: "2.3.4" + versionName: "Gingerbread" platform: type: "mobile" engine: @@ -2017,6 +2022,7 @@ os: name: "Android" version: "1.6" + versionName: "Donut" platform: type: "mobile" engine: @@ -2254,6 +2260,7 @@ os: name: "Android" version: "4.1.2" + versionName: "Jelly Bean" platform: type: "tablet" engine: @@ -2445,6 +2452,7 @@ os: name: "Android" version: "5.0.2" + versionName: "Lollipop" platform: type: "mobile" engine: @@ -2474,6 +2482,7 @@ os: name: "Android" version: "6.0" + versionName: "Marshmallow" platform: type: "mobile" engine: @@ -2488,6 +2497,7 @@ os: name: "Android" version: "7.1.1" + versionName: "Nougat" platform: type: "tablet" engine: