Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add test for user agent fragility #10435

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/app/store/__tests__/GlobalStoreModel.tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { __globalStoreTestUtils__, GlobalStore } from "app/store/GlobalStore"
import {
__globalStoreTestUtils__,
getCurrentEmissionState,
GlobalStore,
} from "app/store/GlobalStore"
import { CURRENT_APP_VERSION } from "app/store/migration"
import { pass } from "jest-extended"
import mockFetch from "jest-fetch-mock"

describe("GlobalStoreModel", () => {
Expand Down Expand Up @@ -45,6 +50,20 @@ describe("GlobalStoreModel", () => {
).toEqual("Banksy")
})

it("returns expected user agent", () => {
const userAgent = getCurrentEmissionState().userAgent
if (!userAgent.includes("Artsy-Mobile")) {
fail(`
!!! The user agent for eigen has changed,
this will break things elsewhere.
If this is intended updates must be made outside eigen, see here:
https://github.com/artsy/gravity/pull/17853
`)
} else {
pass("User agent contains Artsy-Mobile")
}
})

it("can be manipulated", () => {
// Here we will be using `testStuff` that doesn't exist, but it is safe to test with this.
// We don't have any other simple thing that we can test with.
Expand Down