Skip to content

Commit

Permalink
chore: add test for user agent fragility (#10435)
Browse files Browse the repository at this point in the history
add test for user agent fragility

update
  • Loading branch information
brainbicycle committed Jun 26, 2024
1 parent 1df1a2e commit 85baa0e
Showing 1 changed file with 20 additions and 1 deletion.
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

0 comments on commit 85baa0e

Please sign in to comment.