Download mobile/modules/bluetooth-sdk/plugin/src/__tests__/withIos.test.ts from Anirudh1950/MentraOS: direct link, hf CLI and curl.
- Browser
- Download file 2.66 kB
-
https://huggingface.co/Anirudh1950/MentraOS/resolve/main/mobile/modules/bluetooth-sdk/plugin/src/__tests__/withIos.test.ts
- Command line
-
hf download hf://Anirudh1950/MentraOS/mobile/modules/bluetooth-sdk/plugin/src/__tests__/withIos.test.ts
-
curl -L -o withIos.test.ts https://huggingface.co/Anirudh1950/MentraOS/resolve/main/mobile/modules/bluetooth-sdk/plugin/src/__tests__/withIos.test.ts
2.66 kB
| const packageJson = require("../../../package.json") | |
| const { | |
| applyBluetoothSdkInfoPlist, | |
| INFO_SDK_VERSION, | |
| INFO_ANALYTICS_ENVIRONMENT, | |
| } = require("../withIos") | |
| describe("Bluetooth SDK iOS config", () => { | |
| it("stamps the package version into Info.plist for workspace builds", () => { | |
| const infoPlist = applyBluetoothSdkInfoPlist({}, undefined) | |
| expect(infoPlist[INFO_SDK_VERSION]).toBe(packageJson.version) | |
| }) | |
| it("preserves analytics configuration while stamping the SDK version", () => { | |
| const infoPlist = applyBluetoothSdkInfoPlist( | |
| { | |
| MentraBluetoothSdkPostHogApiKey: "stale-key", | |
| MentraBluetoothSdkPostHogHost: "https://stale.example.com", | |
| }, | |
| {analytics: false}, | |
| ) | |
| expect(infoPlist).toMatchObject({ | |
| [INFO_SDK_VERSION]: packageJson.version, | |
| MentraBluetoothSdkAnalyticsDisabled: true, | |
| }) | |
| expect(infoPlist).not.toHaveProperty("MentraBluetoothSdkPostHogApiKey") | |
| expect(infoPlist).not.toHaveProperty("MentraBluetoothSdkPostHogHost") | |
| }) | |
| it("stamps the host environment and clears a stale one when unset", () => { | |
| const stamped = applyBluetoothSdkInfoPlist({}, {analytics: {environment: "Staging"}}) | |
| expect(stamped[INFO_ANALYTICS_ENVIRONMENT]).toBe("staging") | |
| expect(stamped).not.toHaveProperty("MentraBluetoothSdkAnalyticsDisabled") | |
| const cleared = applyBluetoothSdkInfoPlist({[INFO_ANALYTICS_ENVIRONMENT]: "prod"}, {analytics: true}) | |
| expect(cleared).not.toHaveProperty(INFO_ANALYTICS_ENVIRONMENT) | |
| expect(cleared.MentraBluetoothSdkAnalyticsDisabled).toBe(false) | |
| }) | |
| it("declares Bluetooth background execution so reconnects complete while the phone is locked", () => { | |
| const infoPlist = applyBluetoothSdkInfoPlist({}, undefined) | |
| expect(infoPlist.UIBackgroundModes).toEqual(["bluetooth-central"]) | |
| }) | |
| it("merges into the app's existing background modes without duplicating them", () => { | |
| const withAudio = applyBluetoothSdkInfoPlist({UIBackgroundModes: ["audio", "location"]}, undefined) | |
| expect(withAudio.UIBackgroundModes).toEqual(["audio", "location", "bluetooth-central"]) | |
| const alreadyDeclared = applyBluetoothSdkInfoPlist( | |
| {UIBackgroundModes: ["bluetooth-central", "audio"]}, | |
| undefined, | |
| ) | |
| expect(alreadyDeclared.UIBackgroundModes).toEqual(["bluetooth-central", "audio"]) | |
| }) | |
| it("rejects a malformed UIBackgroundModes value instead of dropping the app's modes", () => { | |
| expect(() => applyBluetoothSdkInfoPlist({UIBackgroundModes: "audio"}, undefined)).toThrow( | |
| "UIBackgroundModes must be an array", | |
| ) | |
| }) | |
| }) | |