Skip to content

Commit

Permalink
Enums (#1)
Browse files Browse the repository at this point in the history
* init

* enums
  • Loading branch information
hasnainroopawalla authored Apr 5, 2024
1 parent 9768301 commit b7c6fe2
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 3 deletions.
72 changes: 72 additions & 0 deletions src/enums.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
export enum Browser {
AmazonSilk = "amazon_silk",
Android = "android",
Bada = "bada",
Blackberry = "blackberry",
Chrome = "chrome",
Chromium = "chromium",
Electron = "electron",
Epiphany = "epiphany",
Firefox = "firefox",
Focus = "focus",
Generic = "generic",
Googlebot = "googlebot",
GoogleSearch = "google_search",
InternetExplorer = "ie",
KMeleon = "k_meleon",
Maxthon = "maxthon",
Edge = "edge",
MZ = "mz",
Naver = "naver",
Opera = "opera",
OperaCoast = "opera_coast",
PhantomJS = "phantomjs",
Puffin = "puffin",
QupZilla = "qupzilla",
QQBrowser = "qq",
QQBrowserLite = "qqlite",
Safari = "safari",
Sailfish = "sailfish",
SamsungInternet = "samsung_internet",
SeaMonkey = "seamonkey",
Sleipnir = "sleipnir",
Swing = "swing",
Tizen = "tizen",
UCBrowser = "uc",
Vivaldi = "vivaldi",
WebOS = "webos",
WeChat = "wechat",
Yandex = "yandex",
}

export enum Platform {
Tablet = "tablet",
Mobile = "mobile",
Desktop = "desktop",
Tv = "tv",
}

export enum OS {
WindowsPhone = "WindowsPhone",
Windows = "Windows",
MacOS = "MacOS",
iOS = "iOS",
Android = "Android",
WebOS = "WebOS",
BlackBerry = "BlackBerry",
Bada = "Bada",
Tizen = "Tizen",
Linux = "Linux",
ChromeOS = "ChromeOS",
PlayStation4 = "PlayStation4",
Roku = "Roku",
}

export enum Engine {
EdgeHTML = "EdgeHTML",
Blink = "Blink",
Trident = "Trident",
Presto = "Presto",
Gecko = "Gecko",
WebKit = "WebKit",
}
3 changes: 0 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import React from "react";
import ReactDOM from "react-dom/client";
import Bowser from "bowser";

console.log(Bowser.BROWSER_MAP);

const root = ReactDOM.createRoot(
document.getElementById("root") as HTMLElement
Expand Down
24 changes: 24 additions & 0 deletions tests/enums.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import Bowser from "bowser";
import { Browser, Engine, OS, Platform } from "../src/enums";

describe("Enums", () => {
test("Browser", () => {
expect(Object.keys(Bowser.BROWSER_MAP)).toMatchObject(
Object.values(Browser)
);
});

test("OS", () => {
expect(Object.keys(Bowser.OS_MAP)).toMatchObject(Object.values(OS));
});

test("Platform", () => {
expect(Object.keys(Bowser.PLATFORMS_MAP)).toMatchObject(
Object.values(Platform)
);
});

test("Engine", () => {
expect(Object.keys(Bowser.ENGINE_MAP)).toMatchObject(Object.values(Engine));
});
});
Empty file removed tests/flow.test.ts
Empty file.

0 comments on commit b7c6fe2

Please sign in to comment.