Add eslint rule and fix as many issues as possible

This commit is contained in:
Khoa Le
2023-06-19 23:42:04 -04:00
parent e9eacc445d
commit 9d33e4756b
689 changed files with 9446 additions and 21821 deletions
+11 -11
View File
@@ -1,29 +1,29 @@
import { describe, test, expect } from '@jest/globals';
import { getChannelFromUserAgent } from '../../../src/utils/posthog';
import { describe, expect, test } from "@jest/globals";
import { getChannelFromUserAgent } from "../../../src/utils/posthog";
describe('posthog getChannelFromUserAgent', () => {
describe("posthog getChannelFromUserAgent", () => {
test("should return 'web' when userAgent includes 'mozilla'", () => {
const userAgent =
'Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.5563.115 Mobile Safari/537.36';
"Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.5563.115 Mobile Safari/537.36";
const channel = getChannelFromUserAgent(userAgent);
expect(channel).toBe('web');
expect(channel).toBe("web");
});
test("should return 'cli'", () => {
const userAgent = 'cli';
const userAgent = "cli";
const channel = getChannelFromUserAgent(userAgent);
expect(channel).toBe('cli');
expect(channel).toBe("cli");
});
test("should return 'k8-operator'", () => {
const userAgent = 'k8-operator';
const userAgent = "k8-operator";
const channel = getChannelFromUserAgent(userAgent);
expect(channel).toBe('k8-operator');
expect(channel).toBe("k8-operator");
});
test('should return undefined if no userAgent', () => {
test("should return undefined if no userAgent", () => {
const userAgent = undefined;
const channel = getChannelFromUserAgent(userAgent);
expect(channel).toBe('other');
expect(channel).toBe("other");
});
});