Files
TREK/client/src/native/cloudOrders.test.ts
T
Maurice dedbf16f03 fix(native): Android offers TREK Cloud while orders are closed and says a refused purchase is refunded
The licence testers of the internal test buy from a release build, so the
plan screen no longer hides the purchase on Android before the opening.
Their purchases are Play test purchases, which the cloud serves. A real
purchase made before the opening is refused with ordering-closed and never
acknowledged, so Google Play refunds it after three days; the claim and the
restore now say that instead of a general error. The app still acknowledges
a purchase only after a redeem that returned an instance. iOS is unchanged.
2026-11-08 02:31:13 +00:00

36 lines
1.5 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { opensSoon, refundedBeforeOpening } from './cloudOrders';
describe('opensSoon', () => {
const base = { available: true, closed: true, sandbox: false, onPlay: false };
it('FE-NATIVE-ORDERS-001: closed orders hide the purchase from an App Store build', () => {
expect(opensSoon(base)).toBe(true);
});
it('FE-NATIVE-ORDERS-002: a TestFlight build may buy while orders are closed', () => {
expect(opensSoon({ ...base, sandbox: true })).toBe(false);
});
it('FE-NATIVE-ORDERS-003: an Android release build keeps the purchase while orders are closed', () => {
expect(opensSoon({ ...base, onPlay: true })).toBe(false);
});
it('FE-NATIVE-ORDERS-004: open orders and a binary without a store never say "opens soon"', () => {
expect(opensSoon({ ...base, closed: false })).toBe(false);
expect(opensSoon({ ...base, available: false })).toBe(false);
});
});
describe('refundedBeforeOpening', () => {
it('FE-NATIVE-ORDERS-005: a purchase refused as ordering-closed on Android is the refunded one', () => {
expect(refundedBeforeOpening('ordering-closed', true)).toBe(true);
});
it('FE-NATIVE-ORDERS-006: other refusals, and ordering-closed on iOS, keep the general message', () => {
expect(refundedBeforeOpening('ordering-closed', false)).toBe(false);
expect(refundedBeforeOpening('redeem-failed', true)).toBe(false);
expect(refundedBeforeOpening(undefined, true)).toBe(false);
});
});