Download mobile/modules/bluetooth-sdk/plugin/src/__tests__/analyticsProps.test.ts from Anirudh1950/MentraOS: direct link, hf CLI and curl.
- Browser
- Download file 1.55 kB
-
https://huggingface.co/Anirudh1950/MentraOS/resolve/main/mobile/modules/bluetooth-sdk/plugin/src/__tests__/analyticsProps.test.ts
- Command line
-
hf download hf://Anirudh1950/MentraOS/mobile/modules/bluetooth-sdk/plugin/src/__tests__/analyticsProps.test.ts
-
curl -L -o analyticsProps.test.ts https://huggingface.co/Anirudh1950/MentraOS/resolve/main/mobile/modules/bluetooth-sdk/plugin/src/__tests__/analyticsProps.test.ts
1.55 kB
| const {resolveAnalyticsProps, normalizeAnalyticsEnvironment} = require("../analyticsProps") | |
| describe("Bluetooth SDK analytics plugin props", () => { | |
| it("leaves the native default alone when nothing is configured", () => { | |
| expect(resolveAnalyticsProps(undefined)).toEqual({disabled: undefined, environment: undefined}) | |
| expect(resolveAnalyticsProps({})).toEqual({disabled: undefined, environment: undefined}) | |
| }) | |
| it("maps the boolean shorthand", () => { | |
| expect(resolveAnalyticsProps({analytics: false}).disabled).toBe(true) | |
| expect(resolveAnalyticsProps({analytics: true}).disabled).toBe(false) | |
| }) | |
| it("accepts an environment alongside the enabled flag", () => { | |
| expect(resolveAnalyticsProps({analytics: {enabled: true, environment: " Prod "}})).toEqual({ | |
| disabled: false, | |
| environment: "prod", | |
| }) | |
| expect(resolveAnalyticsProps({analytics: {environment: "staging"}})).toEqual({ | |
| disabled: undefined, | |
| environment: "staging", | |
| }) | |
| }) | |
| it("rejects environments that would not survive as a PostHog filter value", () => { | |
| expect(() => normalizeAnalyticsEnvironment("has space")).toThrow(/analytics\.environment/) | |
| expect(() => normalizeAnalyticsEnvironment("-leading")).toThrow(/analytics\.environment/) | |
| expect(() => normalizeAnalyticsEnvironment("a".repeat(33))).toThrow(/analytics\.environment/) | |
| expect(() => normalizeAnalyticsEnvironment(42)).toThrow(/must be a string/) | |
| expect(normalizeAnalyticsEnvironment("")).toBeUndefined() | |
| }) | |
| }) | |