create-disposabl-app 0.17.5 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/disposabl.js +43 -10
- package/dist/index.js +64 -18
- package/dist/templates/default/apps/mobile/README.md +40 -0
- package/dist/templates/default/apps/mobile/app.config.js +46 -2
- package/dist/templates/default/apps/mobile/package.json +7 -1
- package/dist/templates/default/apps/mobile/plugins/with-android-signing.js +23 -1
- package/dist/templates/default/apps/mobile/scripts/fresh-android.mjs +24 -0
- package/dist/templates/default/apps/mobile/scripts/play-aab.mjs +176 -0
- package/dist/templates/default/apps/mobile/scripts/verify-play-aab.mjs +77 -0
- package/dist/templates/default/bun.lock +12 -3
- package/dist/templates/default/bunfig.toml +1 -0
- package/dist/templates/default/package.json +6 -2
- package/dist/templates/default/packages/backend/convex/files/guard.ts +2 -0
- package/dist/templates/default/packages/backend/convex/http.ts +11 -1
- package/dist/templates/default/packages/backend/convex/schema.ts +10 -0
- package/dist/templates/default/packages/backend/convex/telemetry.ts +12 -16
- package/dist/templates/default/packages/cli/build.ts +4 -0
- package/dist/templates/default/packages/cli/package.json +2 -1
- package/dist/templates/default/packages/cli/telemetry.ts +40 -3
- package/dist/templates/default/packages/disposabl-kit/PAYMENTS.md +2 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/account-deletion.tsx +111 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/consent-identity.tsx +50 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/legal-page.tsx +12 -1
- package/dist/templates/default/packages/disposabl-kit/client/lib/telemetry-lease.ts +200 -0
- package/dist/templates/default/packages/disposabl-kit/client/lib/telemetry.ts +8 -1
- package/dist/templates/default/packages/disposabl-kit/client/routes/consent.tsx +23 -1
- package/dist/templates/default/packages/disposabl-kit/client/routes/legal/delete-account.tsx +6 -1
- package/dist/templates/default/packages/disposabl-kit/client/routes/legal/support.tsx +33 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/pricing.tsx +13 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/route.tsx +19 -2
- package/dist/templates/default/packages/disposabl-kit/client/vite.config.ts +1 -0
- package/dist/templates/default/packages/disposabl-kit/legal/README.md +1 -1
- package/dist/templates/default/packages/disposabl-kit/legal/config.ts +32 -4
- package/dist/templates/default/packages/disposabl-kit/legal/index.ts +2 -2
- package/dist/templates/default/packages/disposabl-kit/legal/publisher.ts +6 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/billing/account-billing.tsx +13 -9
- package/dist/templates/default/packages/disposabl-kit/mobile/billing/paywall.ts +28 -4
- package/dist/templates/default/packages/disposabl-kit/mobile/billing/policy.ts +31 -14
- package/dist/templates/default/packages/disposabl-kit/mobile/billing/web-checkout.ts +45 -34
- package/dist/templates/default/packages/disposabl-kit/mobile/components/settings-links.tsx +14 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/expo-plugin.cjs +3 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/index.ts +4 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/layout.tsx +55 -8
- package/dist/templates/default/packages/disposabl-kit/server/billing-functions.ts +147 -124
- package/dist/templates/default/packages/disposabl-kit/server/billing-handoff.ts +113 -95
- package/dist/templates/default/packages/disposabl-kit/server/files-functions.ts +70 -54
- package/dist/templates/default/packages/disposabl-kit/server/http.ts +49 -21
- package/dist/templates/default/packages/disposabl-kit/server/lib/platform-spec.ts +25 -1
- package/dist/templates/default/packages/disposabl-kit/server/lib/telemetry.ts +375 -69
- package/dist/templates/default/packages/disposabl-kit/server/release/clients.mjs +28 -1
- package/dist/templates/default/packages/disposabl-kit/server/release/verify-metadata.mjs +64 -0
- package/dist/templates/default/packages/sdk/README.md +2 -0
- package/dist/templates/default/packages/sdk/build.ts +8 -0
- package/dist/templates/default/packages/sdk/package.json +3 -2
- package/dist/templates/default/packages/sdk/src/analytics.ts +7 -2
- package/dist/templates/default/packages/skill/SKILL.md +4 -2
- package/dist/templates/default/packages/skill/references/store-submissions.md +25 -0
- package/dist/templates/default/packages/tests/README.md +28 -1
- package/dist/templates/default/packages/tests/account-deletion-ui.test.ts +21 -0
- package/dist/templates/default/packages/tests/auth-email-setup.test.ts +45 -0
- package/dist/templates/default/packages/tests/components/account-deletion.test.mjs +82 -0
- package/dist/templates/default/packages/tests/components/consent-identity.test.mjs +175 -0
- package/dist/templates/default/packages/tests/components/mobile-deletion-link.test.mjs +40 -0
- package/dist/templates/default/packages/tests/components/mobile-theme.test.mjs +56 -3
- package/dist/templates/default/packages/tests/components/pricing-identity.test.mjs +113 -0
- package/dist/templates/default/packages/tests/components/support-page.test.mjs +36 -0
- package/dist/templates/default/packages/tests/consent-identity.test.ts +13 -0
- package/dist/templates/default/packages/tests/desktop-macos-release.test.ts +153 -145
- package/dist/templates/default/packages/tests/flows/legal.e2e.ts +40 -3
- package/dist/templates/default/packages/tests/helpers/auth-email-setup/probe.test.mjs +44 -0
- package/dist/templates/default/packages/tests/helpers/mobile-simulator/preflight.py +80 -0
- package/dist/templates/default/packages/tests/helpers/mobile-simulator/test_preflight.py +57 -0
- package/dist/templates/default/packages/tests/mobile-android-e2e-network.test.ts +81 -1
- package/dist/templates/default/packages/tests/mobile-android-signing.test.ts +52 -0
- package/dist/templates/default/packages/tests/mobile-deletion-link.test.ts +21 -0
- package/dist/templates/default/packages/tests/mobile-ios-reachability-pin.test.ts +84 -0
- package/dist/templates/default/packages/tests/mobile-simulator-preflight.test.ts +16 -0
- package/dist/templates/default/packages/tests/native-billing.test.ts +288 -0
- package/dist/templates/default/packages/tests/pricing-identity.test.ts +13 -0
- package/dist/templates/default/packages/tests/sdk-analytics.test.ts +28 -2
- package/dist/templates/default/packages/tests/support-page.test.ts +13 -0
- package/dist/templates/default/packages/tests/telemetry.test.ts +389 -18
- package/dist/templates/default/packages/tests/ui-telemetry-lease.test.ts +346 -0
- package/dist/templates/default/patches/convex-mcp-account-erasure-alpha7.patch +466 -0
- package/dist/templates/default/vendor/README.md +61 -1
- package/dist/templates/default/vendor/convex-auth-040d8e36-disposabl.1.patch +890 -0
- package/dist/templates/default/vendor/convex-auth-040d8e36-disposabl.1.tgz +0 -0
- package/dist/templates/default/vendor/convex-auth-040d8e36-disposabl.2.patch +1060 -0
- package/dist/templates/default/vendor/convex-auth-040d8e36-disposabl.2.tgz +0 -0
- package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.4.tgz +0 -0
- package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.5.tgz +0 -0
- package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.6.tgz +0 -0
- package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.7.tgz +0 -0
- package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.8.tgz +0 -0
- package/dist/templates/default/vendor/convex-auth-core-erasure-disposabl.6.patch +115 -0
- package/dist/templates/default/vendor/convex-auth-identity-cutoff-disposabl.7.patch +442 -0
- package/dist/templates/default/vendor/convex-auth-identity-erasure-disposabl.8.md +11 -0
- package/dist/templates/default/vendor/convex-auth-identity-erasure-disposabl.8.patch +78 -0
- package/dist/templates/default/vendor/convex-auth-marker-disposabl.4.patch +169 -0
- package/dist/templates/default/vendor/convex-auth-marker-password-disposabl.5.patch +126 -0
- package/dist/verify-metadata.mjs +64 -0
- package/package.json +3 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# App Store and Google Play submissions
|
|
2
|
+
|
|
3
|
+
Use this workflow when the user requests store submission or release. Follow their chosen platforms, accounts, distribution timing, and build constraints. Prior authorization to submit or release remains effective; ask only for information, access, or a decision that is actually missing, or when a tool or legal boundary requires it.
|
|
4
|
+
|
|
5
|
+
## Match the existing app
|
|
6
|
+
|
|
7
|
+
Identify the exact App Store Connect (ASC) app record and Apple ID, bundle ID, team, and current release; identify the Play Console app record, package name, track, version code, and signing configuration. Reuse the existing listing when the identifiers and ownership match. Do not infer identity from the display name or an Expo project. If no matching record exists, create a new record only within the requested scope; explain that it is a new listing, not an update or migration of the existing app.
|
|
8
|
+
|
|
9
|
+
Compare the actual release artifact's identifier, version/build number, signing certificate and entitlements with the store record and authorized team. An ASC bundle ID cannot be changed after a build upload. A Play update needs the same package name, a higher version code, and the correct upload signing key; distinguish the upload certificate from the Play-held app signing certificate. Do not expose private keys or credentials. Stop and report a mismatch instead of uploading to a different listing or replacing signing identity. See [Apple app information](https://developer.apple.com/help/app-store-connect/reference/app-information/app-information/), [Play app updates](https://support.google.com/googleplay/android-developer/answer/9859350), and [Play App Signing](https://support.google.com/googleplay/android-developer/answer/9842756).
|
|
10
|
+
|
|
11
|
+
## Build, reviewer access, and evidence
|
|
12
|
+
|
|
13
|
+
Use the user's required build path. When local iOS builds are requested, create a signed device archive with local Xcode and export/upload through the supported App Store Connect path; do not use EAS cloud builds. A simulator build, ad-hoc signature, preview IPA, or keyless payments fixture is not a submission artifact. For Play, build the correctly signed release Android App Bundle (`.aab`); an APK proves neither an AAB upload nor Play delivery. Record source SHA, artifact digest, identifiers, versions, signing evidence, and the target deployment. Verify the release build on an appropriate device, including login, real requested features, saved data after relaunch, and the intended backend. Report any unverified behavior instead of claiming readiness.
|
|
14
|
+
|
|
15
|
+
If review requires login, provision a dedicated reviewer account for the actual app and review backend using a login method supported by the submitted build and backend. Give it only the permissions and resources needed to exercise the real submitted features; include any required roles, reachable backend, purchase access, and steps. Prepared credentials alone are not an account: register it, then verify login and those features on the submitted build, relaunch, and verify session and data before calling reviewer access ready. Keep credentials out of source, Git, skill files, logs, screenshots, and public chat; enter them only in the store's designated review-access fields via an authorized secure channel. Keep the account and backend usable through review. If Apple requires a subscription flow, follow its current guidance for a review account that can demonstrate it. Explain genuine limits and setup in review notes rather than presenting a mock as a working feature. See [Apple review information](https://developer.apple.com/help/app-review/before-submitting-for-review/complete-review) and [Google review access](https://support.google.com/googleplay/android-developer/answer/15191715).
|
|
16
|
+
|
|
17
|
+
Use truthful screenshots from the submitted app and supported devices; ensure metadata, privacy policy, age/content ratings, Apple privacy declarations, and Play Data safety reflect the actual app, backend, SDKs, and regional behavior. Do not invent data practices or claim unavailable features. Check [Apple screenshot specifications](https://developer.apple.com/help/app-store-connect/reference/app-information/screenshot-specifications), [Apple privacy details](https://developer.apple.com/app-store/submitting/), and [Play Data safety](https://support.google.com/googleplay/android-developer/answer/10787469).
|
|
18
|
+
|
|
19
|
+
## Payments and release states
|
|
20
|
+
|
|
21
|
+
For enabled digital purchases, verify the configured products, prices, store offerings, sandbox transaction, restore and provider synchronization against the intended app and environment. Distinguish local StoreKit configuration, Apple/Google sandbox, provider synchronization, and production fulfillment. A button, mock, or redirect is not proof of payment or credited balance.
|
|
22
|
+
|
|
23
|
+
For iOS website checkout, verify the actual US StoreKit storefront and purchase eligibility, website option, return flow and authoritative balance refresh. For non-US storefronts retain the applicable native in-app purchase path unless a verified regional entitlement or exception applies. Check the current [Apple review guidelines, section 3.1](https://developer.apple.com/app-store/review/guidelines/) and the app's payment configuration; do not assume a US exception applies worldwide. For Android, follow the current [Google Play payments policy](https://support.google.com/googleplay/android-developer/answer/9858738) and any applicable enrolled regional program; do not treat the iOS policy as Android authorization.
|
|
24
|
+
|
|
25
|
+
Track each platform separately: artifact built and signed; uploaded; processed and associated with the exact app/version; submitted for review; review outcome; and public or staged release. Upload or TestFlight availability is not App Review submission. Select the store's release mode consistent with the user's instructions and check whether approval triggers automatic publication. Confirm final state in the relevant console and report precise links, identifiers, and blockers. See [Apple submit an app](https://developer.apple.com/help/app-store-connect/manage-submissions-to-app-review/submit-an-app), [Apple release options](https://developer.apple.com/help/app-store-connect/manage-your-apps-availability/select-an-app-store-version-release-option), and [Play publishing overview](https://support.google.com/googleplay/android-developer/answer/9859654).
|
|
@@ -23,7 +23,7 @@ For an isolated preview or CI deployment, set `E2E_CONVEX_URL` and `E2E_CONVEX_S
|
|
|
23
23
|
|
|
24
24
|
The initial flows check the public web page, the dashboard's authentication boundary, an anonymous backend auth query, the API contract when enabled, and the mobile home screen. They do not create users or modify data. Add product-specific flows here as behavior changes, including login and saved-state checks using dedicated test users. Keep required flows deterministic; an agent can write and debug tests without adding model calls to their execution.
|
|
25
25
|
|
|
26
|
-
The
|
|
26
|
+
The opt-in account-deletion receipt flow runs through `python3 packages/tests/fixtures/billing-handoff-browser/run.py receipt` with `CONVEX_LOCAL_BINARY` and `PLAYWRIGHT_BROWSERS_PATH` set as documented in that fixture's README. It uses a fresh owned 3530/3531 backend and a synthetic account, downloads a private receipt, then clears that account's authentication. Retained logs, screenshots, database and receipt may contain synthetic session data; keep them private. This does not prove whole-account deletion.
|
|
27
27
|
|
|
28
28
|
The storage fallback flow (`flows/files.e2e.ts`) uses the same loopback/admin restriction to confirm R2 is not configured before uploading. It checks downloaded bytes, anonymous and cross-user rejection, and owner deletion, removing only its own new file. It makes no R2 requests and skips when R2 is fully configured.
|
|
29
29
|
|
|
@@ -71,3 +71,30 @@ Both `bun run test` and `bun run e2e ...` set `E2E_TELEMETRY_DISABLED=1`. Keep u
|
|
|
71
71
|
Upstream telemetry otherwise sends command/engine/runtime versions, environment categories, durations, test counts, error codes, and AI/cache usage to the maintainers' PostHog project. It excludes test titles, source, URLs, screenshots, prompts, credentials, and error messages. See [the event inventory](https://github.com/tester-army/e2e/blob/main/docs/telemetry.mdx) and [transport source](https://github.com/tester-army/e2e/blob/main/packages/e2e/src/telemetry/posthog.ts).
|
|
72
72
|
|
|
73
73
|
AI is optional. To add it later, read `bun run e2e guide setup` and configure a provider or the upstream Codex/Claude Code ACP adapter. Keep model-backed flows separate from the required deterministic suite; an AI key appearing in the environment must not silently change the build gate or start spending.
|
|
74
|
+
|
|
75
|
+
<!-- mobile-simulator-preflight:start -->
|
|
76
|
+
|
|
77
|
+
### Isolated iOS simulator acceptance preflight
|
|
78
|
+
|
|
79
|
+
For a disposable E2E-only simulator build, select a unique preview bundle ID and URL scheme, set `EXPO_NO_DOTENV=1`, `EXPO_PUBLIC_E2E=true`, `E2E_TELEMETRY_DISABLED=1`, and the two `EXPO_PUBLIC_CONVEX_*` URLs to the assigned `http://127.0.0.1:<port>` backend. Disable updates and payments in the fixture. Use an allowlisted environment with Expo telemetry disabled and no provider credentials. Keep the original app and its data. On macOS, create a disposable simulator-only entitlements plist with `application-identifier` and the sole `keychain-access-groups` entry both set to `local.<unique-preview-bundle-id>`. After Expo prebuild and pod installation, from `apps/mobile` the tested Xcode invocation is:
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
xcodebuild -workspace ios/Disposabl.xcworkspace -scheme Disposabl -configuration Release \
|
|
83
|
+
-sdk iphonesimulator -destination 'generic/platform=iOS Simulator' \
|
|
84
|
+
-derivedDataPath "$SIMULATOR_DERIVED" -jobs 2 CODE_SIGNING_ALLOWED=YES \
|
|
85
|
+
CODE_SIGNING_REQUIRED=YES CODE_SIGN_IDENTITY=- DEVELOPMENT_TEAM= \
|
|
86
|
+
CODE_SIGN_ENTITLEMENTS="$SIMULATOR_ENTITLEMENTS" build
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
This is a local simulator fixture, not a production signing recipe. Capture a build record JSON with exactly `source_revision`, `js_sha256`, `app_id`, `backend`, `site`, and Boolean `e2e`, `telemetry_disabled`, `updates_disabled`, `payments_disabled`. The SHA is of the finished `main.jsbundle`; record the actual build inputs, not intended ones. Run:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
python3 packages/tests/helpers/mobile-simulator/preflight.py \
|
|
93
|
+
--app "$SIMULATOR_APP" --record "$BUILD_RECORD" --source "$SOURCE_CHECKOUT" \
|
|
94
|
+
--app-id "$PREVIEW_APP_ID" --group "local.$PREVIEW_APP_ID" \
|
|
95
|
+
--backend "$EXPO_PUBLIC_CONVEX_URL" --site "$EXPO_PUBLIC_CONVEX_SITE_URL" \
|
|
96
|
+
--hermesc "$SOURCE_CHECKOUT/apps/mobile/ios/Pods/hermes-engine/destroot/bin/hermesc"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Preflight checks ARM64 simulator platform, linked simulator entitlement sections and identities, embedded URLs, disabled updates, JS hash and matching record. A record is an operator attestation: it cannot independently prove source provenance, E2E flags, payments or telemetry behavior. Retain the build logs and confirm the checkout and build inputs separately. A passing preflight does not establish installation or behavior. Xcode's separate codesign entitlement dictionary is not a substitute for inspecting the simulated Mach-O entitlement sections.
|
|
100
|
+
<!-- mobile-simulator-preflight:end -->
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { test } from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
|
|
6
|
+
test("account deletion UI handles authentication and request states", () => {
|
|
7
|
+
for (const disabled of ["true", "false"]) {
|
|
8
|
+
const result = spawnSync(
|
|
9
|
+
process.execPath,
|
|
10
|
+
[
|
|
11
|
+
"test",
|
|
12
|
+
join(import.meta.dirname, "components/account-deletion.test.mjs"),
|
|
13
|
+
],
|
|
14
|
+
{
|
|
15
|
+
encoding: "utf8",
|
|
16
|
+
env: { ...process.env, TEST_AUTH_DISABLED: disabled },
|
|
17
|
+
},
|
|
18
|
+
);
|
|
19
|
+
assert.equal(result.status, 0, result.stdout + result.stderr);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { test } from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
|
|
6
|
+
function probe(variables: Record<string, string>) {
|
|
7
|
+
const result = spawnSync(
|
|
8
|
+
process.execPath,
|
|
9
|
+
[
|
|
10
|
+
"--no-env-file",
|
|
11
|
+
"test",
|
|
12
|
+
join(import.meta.dirname, "helpers/auth-email-setup/probe.test.mjs"),
|
|
13
|
+
],
|
|
14
|
+
{
|
|
15
|
+
encoding: "utf8",
|
|
16
|
+
env: {
|
|
17
|
+
PATH: process.env.PATH,
|
|
18
|
+
HOME: process.env.HOME,
|
|
19
|
+
TMPDIR: process.env.TMPDIR,
|
|
20
|
+
NODE_ENV: "test",
|
|
21
|
+
CI: "1",
|
|
22
|
+
DO_NOT_TRACK: "1",
|
|
23
|
+
E2E_TELEMETRY_DISABLED: "1",
|
|
24
|
+
CONVEX_SITE_URL: "http://127.0.0.1:3481",
|
|
25
|
+
...variables,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
);
|
|
29
|
+
assert.equal(result.status, 0, result.stdout + result.stderr);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
test("email setup uses the built-in site URL without a sender", () => {
|
|
33
|
+
probe({ EXPECT_ORIGIN: "http://127.0.0.1:3481" });
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test("email setup uses a valid explicit origin", () => {
|
|
37
|
+
probe({
|
|
38
|
+
AUTH_EMAIL_ORIGIN: "https://mail.example.invalid",
|
|
39
|
+
EXPECT_ORIGIN: "https://mail.example.invalid",
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test("email setup rejects a malformed explicit origin", () => {
|
|
44
|
+
probe({ AUTH_EMAIL_ORIGIN: "localhost:5173", EXPECT_INVALID: "1" });
|
|
45
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { afterEach, expect, mock, test } from "bun:test";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import { act, create } from "react-test-renderer";
|
|
4
|
+
|
|
5
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
|
|
6
|
+
let authenticated = false;
|
|
7
|
+
const authEnabled = process.env.TEST_AUTH_DISABLED !== "true";
|
|
8
|
+
mock.module("../../disposabl-kit/features", () => ({
|
|
9
|
+
authenticationEnabled: authEnabled,
|
|
10
|
+
}));
|
|
11
|
+
mock.module("convex/react", () => ({
|
|
12
|
+
useConvexAuth: () => {
|
|
13
|
+
if (!authEnabled) throw new Error("Auth hook without provider");
|
|
14
|
+
return { isAuthenticated: authenticated, isLoading: false };
|
|
15
|
+
},
|
|
16
|
+
}));
|
|
17
|
+
const { AccountDeletion, DeletionPanel } =
|
|
18
|
+
await import("../../disposabl-kit/client/components/account-deletion");
|
|
19
|
+
let renderer;
|
|
20
|
+
async function render(element) {
|
|
21
|
+
await act(async () => {
|
|
22
|
+
renderer = create(element);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
const text = () => JSON.stringify(renderer.toJSON());
|
|
26
|
+
afterEach(async () => {
|
|
27
|
+
await act(async () => renderer?.unmount());
|
|
28
|
+
authenticated = false;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("anonymous users get sign-in when authentication is enabled", async () => {
|
|
32
|
+
await render(createElement(AccountDeletion));
|
|
33
|
+
if (authEnabled) {
|
|
34
|
+
expect(text()).toContain("Sign in to manage your account deletion request");
|
|
35
|
+
expect(renderer.root.findByType("a").props.href).toBe(
|
|
36
|
+
"/login?returnTo=%2Flegal%2Fdelete-account",
|
|
37
|
+
);
|
|
38
|
+
} else expect(renderer.toJSON()).toBeNull();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test("signed-in users see unavailable until the backend is wired", async () => {
|
|
42
|
+
if (!authEnabled) return;
|
|
43
|
+
authenticated = true;
|
|
44
|
+
await render(createElement(AccountDeletion));
|
|
45
|
+
expect(text()).toContain("Account deletion requests are not available yet");
|
|
46
|
+
expect(renderer.root.findAllByType("button")).toHaveLength(0);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test("confirmation can be cancelled and only confirm invokes the request", async () => {
|
|
50
|
+
const request = mock();
|
|
51
|
+
await render(
|
|
52
|
+
createElement(DeletionPanel, { state: "idle", onRequest: request }),
|
|
53
|
+
);
|
|
54
|
+
await act(async () =>
|
|
55
|
+
renderer.root.findAllByType("button")[0].props.onClick(),
|
|
56
|
+
);
|
|
57
|
+
expect(text()).toContain("Confirm deletion request");
|
|
58
|
+
await act(async () =>
|
|
59
|
+
renderer.root.findAllByType("button")[1].props.onClick(),
|
|
60
|
+
);
|
|
61
|
+
expect(request).not.toHaveBeenCalled();
|
|
62
|
+
await act(async () =>
|
|
63
|
+
renderer.root.findAllByType("button")[0].props.onClick(),
|
|
64
|
+
);
|
|
65
|
+
await act(async () =>
|
|
66
|
+
renderer.root.findAllByType("button")[0].props.onClick(),
|
|
67
|
+
);
|
|
68
|
+
expect(request).toHaveBeenCalledTimes(1);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test("pending, failure and completed states do not conflate request and deletion", async () => {
|
|
72
|
+
await render(createElement(DeletionPanel, { state: "pending" }));
|
|
73
|
+
expect(text()).toContain("Your account has not yet been deleted");
|
|
74
|
+
await act(async () =>
|
|
75
|
+
renderer.update(createElement(DeletionPanel, { state: "failed" })),
|
|
76
|
+
);
|
|
77
|
+
expect(text()).toContain("could not confirm your deletion request");
|
|
78
|
+
await act(async () =>
|
|
79
|
+
renderer.update(createElement(DeletionPanel, { state: "completed" })),
|
|
80
|
+
);
|
|
81
|
+
expect(text()).toContain("Your account deletion has been completed");
|
|
82
|
+
});
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { afterEach, expect, mock, test } from "bun:test";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import { act, create } from "react-test-renderer";
|
|
4
|
+
import { getFunctionName } from "convex/server";
|
|
5
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
|
|
6
|
+
let token = "alice",
|
|
7
|
+
authenticated = true,
|
|
8
|
+
loading = false;
|
|
9
|
+
let account = { username: "alice", email: null, profile: null },
|
|
10
|
+
user = { id: "user-a", username: "alice" };
|
|
11
|
+
let queue = null;
|
|
12
|
+
let calls = [];
|
|
13
|
+
const convex = { url: "http://127.0.0.1:3540" };
|
|
14
|
+
const request = {
|
|
15
|
+
kind: "redirect",
|
|
16
|
+
status: "pending",
|
|
17
|
+
clientName: "Client",
|
|
18
|
+
serverName: "Service",
|
|
19
|
+
scopes: [],
|
|
20
|
+
redirectUri: "http://localhost/callback",
|
|
21
|
+
};
|
|
22
|
+
mock.module("@convex-dev/auth/react", () => ({ useAuthToken: () => token }));
|
|
23
|
+
mock.module("convex/browser", () => ({
|
|
24
|
+
ConvexHttpClient: class {
|
|
25
|
+
setAuth(value) {
|
|
26
|
+
this.token = value;
|
|
27
|
+
}
|
|
28
|
+
query(reference) {
|
|
29
|
+
const name = getFunctionName(reference);
|
|
30
|
+
calls.push([this.token, name]);
|
|
31
|
+
if (queue) return queue[name];
|
|
32
|
+
return Promise.resolve(name === "auth:account" ? account : user);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
}));
|
|
36
|
+
mock.module("convex/react", () => ({
|
|
37
|
+
useConvex: () => convex,
|
|
38
|
+
useConvexAuth: () => ({ isAuthenticated: authenticated, isLoading: loading }),
|
|
39
|
+
useQuery: () => request,
|
|
40
|
+
useAction: () => async () => ({}),
|
|
41
|
+
}));
|
|
42
|
+
mock.module("@tanstack/react-router", () => ({
|
|
43
|
+
createFileRoute: () => (config) => ({
|
|
44
|
+
...config,
|
|
45
|
+
useSearch: () => ({ request: "request" }),
|
|
46
|
+
}),
|
|
47
|
+
Navigate: () => null,
|
|
48
|
+
}));
|
|
49
|
+
mock.module("../../disposabl-kit/client/components/ui/button", () => ({
|
|
50
|
+
Button: ({ children, ...props }) => createElement("button", props, children),
|
|
51
|
+
}));
|
|
52
|
+
const { Route } = await import("../../disposabl-kit/client/routes/consent");
|
|
53
|
+
let renderer;
|
|
54
|
+
const render = async () =>
|
|
55
|
+
act(async () => {
|
|
56
|
+
renderer = create(createElement(Route.component));
|
|
57
|
+
});
|
|
58
|
+
const refresh = async () =>
|
|
59
|
+
act(async () => {
|
|
60
|
+
renderer.update(createElement(Route.component));
|
|
61
|
+
});
|
|
62
|
+
const text = () => JSON.stringify(renderer.toJSON());
|
|
63
|
+
const allow = () =>
|
|
64
|
+
renderer.root
|
|
65
|
+
.findAllByType("button")
|
|
66
|
+
.find((b) => b.props.children === "Allow");
|
|
67
|
+
afterEach(async () => {
|
|
68
|
+
await act(async () => renderer?.unmount());
|
|
69
|
+
token = "alice";
|
|
70
|
+
authenticated = true;
|
|
71
|
+
loading = false;
|
|
72
|
+
account = { username: "alice", email: null, profile: null };
|
|
73
|
+
user = { id: "user-a", username: "alice" };
|
|
74
|
+
queue = null;
|
|
75
|
+
calls = [];
|
|
76
|
+
});
|
|
77
|
+
test("username, verified email, profile and stable id are displayed", async () => {
|
|
78
|
+
await render();
|
|
79
|
+
expect(text()).toContain("alice");
|
|
80
|
+
expect(allow().props.disabled).toBe(false);
|
|
81
|
+
for (const [value, expected] of [
|
|
82
|
+
[
|
|
83
|
+
{ username: null, email: "verified@example.test", profile: null },
|
|
84
|
+
"verified@example.test",
|
|
85
|
+
],
|
|
86
|
+
[
|
|
87
|
+
{
|
|
88
|
+
username: null,
|
|
89
|
+
email: null,
|
|
90
|
+
profile: { email: "google@example.test" },
|
|
91
|
+
},
|
|
92
|
+
"google@example.test",
|
|
93
|
+
],
|
|
94
|
+
[
|
|
95
|
+
{ username: null, email: null, profile: { name: "Google Name" } },
|
|
96
|
+
"Google Name",
|
|
97
|
+
],
|
|
98
|
+
[{ username: null, email: null, profile: null }, "user-a"],
|
|
99
|
+
]) {
|
|
100
|
+
token += "x";
|
|
101
|
+
account = value;
|
|
102
|
+
await refresh();
|
|
103
|
+
expect(text()).toContain(expected);
|
|
104
|
+
expect(allow().props.disabled).toBe(false);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
test("loading and unavailable block approval; stale account never survives token change", async () => {
|
|
108
|
+
await render();
|
|
109
|
+
expect(allow().props.disabled).toBe(false);
|
|
110
|
+
let finishAccount, finishUser;
|
|
111
|
+
queue = {
|
|
112
|
+
"auth:account": new Promise((r) => {
|
|
113
|
+
finishAccount = r;
|
|
114
|
+
}),
|
|
115
|
+
"users/index:current": new Promise((r) => {
|
|
116
|
+
finishUser = r;
|
|
117
|
+
}),
|
|
118
|
+
};
|
|
119
|
+
token = "bob";
|
|
120
|
+
await refresh();
|
|
121
|
+
expect(text()).toContain("Loading your account");
|
|
122
|
+
expect(text()).not.toContain("alice");
|
|
123
|
+
expect(allow().props.disabled).toBe(true);
|
|
124
|
+
await act(async () => {
|
|
125
|
+
finishAccount({ username: "bob", email: null, profile: null });
|
|
126
|
+
finishUser({ id: "user-b", username: "bob" });
|
|
127
|
+
});
|
|
128
|
+
expect(text()).toContain("bob");
|
|
129
|
+
expect(allow().props.disabled).toBe(false);
|
|
130
|
+
token = "charlie";
|
|
131
|
+
queue = null;
|
|
132
|
+
account = null;
|
|
133
|
+
await refresh();
|
|
134
|
+
expect(text()).toContain("could not be loaded");
|
|
135
|
+
expect(allow().props.disabled).toBe(true);
|
|
136
|
+
loading = true;
|
|
137
|
+
await refresh();
|
|
138
|
+
expect(allow()).toBeUndefined();
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test("late account response cannot overwrite a newer account", async () => {
|
|
142
|
+
let finishOldAccount, finishOldUser;
|
|
143
|
+
queue = {
|
|
144
|
+
"auth:account": new Promise((r) => {
|
|
145
|
+
finishOldAccount = r;
|
|
146
|
+
}),
|
|
147
|
+
"users/index:current": new Promise((r) => {
|
|
148
|
+
finishOldUser = r;
|
|
149
|
+
}),
|
|
150
|
+
};
|
|
151
|
+
await render();
|
|
152
|
+
expect(allow().props.disabled).toBe(true);
|
|
153
|
+
token = "bob";
|
|
154
|
+
queue = null;
|
|
155
|
+
account = { username: "bob", email: null, profile: null };
|
|
156
|
+
user = { id: "user-b", username: "bob" };
|
|
157
|
+
await refresh();
|
|
158
|
+
expect(text()).toContain("bob");
|
|
159
|
+
await act(async () => {
|
|
160
|
+
finishOldAccount({ username: "alice", email: null, profile: null });
|
|
161
|
+
finishOldUser({ id: "user-a", username: "alice" });
|
|
162
|
+
});
|
|
163
|
+
expect(text()).toContain("bob");
|
|
164
|
+
expect(text()).not.toContain("alice");
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
test("failed account lookup leaves approval unavailable", async () => {
|
|
168
|
+
queue = {
|
|
169
|
+
"auth:account": Promise.reject(new Error("offline")),
|
|
170
|
+
"users/index:current": Promise.resolve(user),
|
|
171
|
+
};
|
|
172
|
+
await render();
|
|
173
|
+
expect(text()).toContain("could not be loaded");
|
|
174
|
+
expect(allow().props.disabled).toBe(true);
|
|
175
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { afterEach, expect, mock, test } from "bun:test";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import { act, create } from "react-test-renderer";
|
|
4
|
+
|
|
5
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
|
|
6
|
+
const enabled = process.env.TEST_AUTH_DISABLED !== "true";
|
|
7
|
+
const open = mock(async () => {});
|
|
8
|
+
process.env.EXPO_PUBLIC_CONVEX_SITE_URL = "https://example.test";
|
|
9
|
+
mock.module("../../disposabl-kit/features", () => ({
|
|
10
|
+
authenticationEnabled: enabled,
|
|
11
|
+
}));
|
|
12
|
+
mock.module("react-native", () => ({ Alert: { alert: mock() } }));
|
|
13
|
+
mock.module("expo-web-browser", () => ({ openBrowserAsync: open }));
|
|
14
|
+
mock.module("../../disposabl-kit/mobile/design/preferences", () => ({
|
|
15
|
+
PreferenceRow: "Row",
|
|
16
|
+
PreferenceSection: "Section",
|
|
17
|
+
PreferenceSeparator: "Separator",
|
|
18
|
+
}));
|
|
19
|
+
const { SettingsLinks } =
|
|
20
|
+
await import("../../disposabl-kit/mobile/components/settings-links");
|
|
21
|
+
let renderer;
|
|
22
|
+
afterEach(async () => {
|
|
23
|
+
await act(async () => renderer?.unmount());
|
|
24
|
+
});
|
|
25
|
+
test("delete account is linked only when authentication is enabled", async () => {
|
|
26
|
+
await act(async () => {
|
|
27
|
+
renderer = create(createElement(SettingsLinks));
|
|
28
|
+
});
|
|
29
|
+
const rows = renderer.root.findAllByType("Row");
|
|
30
|
+
const deletion = rows.find((row) => row.props.label === "Delete account");
|
|
31
|
+
if (!enabled) {
|
|
32
|
+
expect(deletion).toBeUndefined();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
expect(deletion).toBeDefined();
|
|
36
|
+
await act(async () => deletion.props.onPress());
|
|
37
|
+
expect(open).toHaveBeenCalledWith(
|
|
38
|
+
"https://example.test/legal/delete-account",
|
|
39
|
+
);
|
|
40
|
+
});
|
|
@@ -17,6 +17,9 @@ const appearance = {
|
|
|
17
17
|
}),
|
|
18
18
|
};
|
|
19
19
|
const read = mock((key) => Promise.resolve(saved.get(key) ?? null));
|
|
20
|
+
const write = mock(async (key, value) => {
|
|
21
|
+
saved.set(key, value);
|
|
22
|
+
});
|
|
20
23
|
mock.module("react-native", () => ({
|
|
21
24
|
View: "View",
|
|
22
25
|
Appearance: appearance,
|
|
@@ -37,9 +40,7 @@ mock.module("expo-router", () => ({
|
|
|
37
40
|
mock.module("expo-status-bar", () => ({ StatusBar: "StatusBar" }));
|
|
38
41
|
mock.module("expo-secure-store", () => ({
|
|
39
42
|
getItemAsync: read,
|
|
40
|
-
setItemAsync:
|
|
41
|
-
saved.set(key, value);
|
|
42
|
-
},
|
|
43
|
+
setItemAsync: write,
|
|
43
44
|
}));
|
|
44
45
|
const {
|
|
45
46
|
ThemeProvider,
|
|
@@ -65,6 +66,8 @@ beforeEach(() => {
|
|
|
65
66
|
saved.clear();
|
|
66
67
|
appearance.setColorScheme.mockClear();
|
|
67
68
|
read.mockImplementation((key) => Promise.resolve(saved.get(key) ?? null));
|
|
69
|
+
write.mockImplementation(async (key, value) => saved.set(key, value));
|
|
70
|
+
write.mockClear();
|
|
68
71
|
});
|
|
69
72
|
afterEach(async () => {
|
|
70
73
|
await act(async () => renderer?.unmount());
|
|
@@ -120,3 +123,53 @@ test("a delayed stored preference cannot replace a user's new choice", async ()
|
|
|
120
123
|
await act(async () => finish("light"));
|
|
121
124
|
expect(selection.preference).toBe("dark");
|
|
122
125
|
});
|
|
126
|
+
|
|
127
|
+
test("failed persistence leaves the visible choice but cannot survive remount", async () => {
|
|
128
|
+
write.mockImplementation(async () => {
|
|
129
|
+
throw new Error("storage unavailable");
|
|
130
|
+
});
|
|
131
|
+
await mount();
|
|
132
|
+
await act(async () => selection.setPreference("dark"));
|
|
133
|
+
expect(selection.preference).toBe("dark");
|
|
134
|
+
expect(saved.has("app-theme")).toBe(false);
|
|
135
|
+
await act(async () => renderer.unmount());
|
|
136
|
+
await mount();
|
|
137
|
+
expect(selection.preference).toBe("system");
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
test("queued choices save in selection order even when a write is delayed", async () => {
|
|
141
|
+
let finish;
|
|
142
|
+
write.mockImplementation((key, value) => {
|
|
143
|
+
if (value === "dark")
|
|
144
|
+
return new Promise((resolve) => {
|
|
145
|
+
finish = () => {
|
|
146
|
+
saved.set(key, value);
|
|
147
|
+
resolve();
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
saved.set(key, value);
|
|
151
|
+
return Promise.resolve();
|
|
152
|
+
});
|
|
153
|
+
await mount();
|
|
154
|
+
await act(async () => selection.setPreference("dark"));
|
|
155
|
+
await act(async () => selection.setPreference("light"));
|
|
156
|
+
expect(write).toHaveBeenCalledTimes(1);
|
|
157
|
+
await act(async () => finish());
|
|
158
|
+
expect(saved.get("app-theme")).toBe("light");
|
|
159
|
+
await act(async () => renderer.unmount());
|
|
160
|
+
await mount();
|
|
161
|
+
expect(selection.preference).toBe("light");
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
test("a read failure falls back to system without writing a replacement", async () => {
|
|
165
|
+
saved.set("app-theme", "dark");
|
|
166
|
+
read.mockImplementation((key) =>
|
|
167
|
+
key === "app-theme"
|
|
168
|
+
? Promise.reject(new Error("storage unavailable"))
|
|
169
|
+
: Promise.resolve(null),
|
|
170
|
+
);
|
|
171
|
+
await mount();
|
|
172
|
+
expect(selection.preference).toBe("system");
|
|
173
|
+
expect(saved.get("app-theme")).toBe("dark");
|
|
174
|
+
expect(write).not.toHaveBeenCalled();
|
|
175
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { afterEach, expect, mock, test } from "bun:test";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import { act, create } from "react-test-renderer";
|
|
4
|
+
import { getFunctionName } from "convex/server";
|
|
5
|
+
|
|
6
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
|
|
7
|
+
const jwt = (subject) =>
|
|
8
|
+
`header.${Buffer.from(JSON.stringify({ sub: subject })).toString("base64url")}.signature`;
|
|
9
|
+
let token = jwt("alice"),
|
|
10
|
+
authenticated = true,
|
|
11
|
+
loading = false;
|
|
12
|
+
let account = { username: "alice", email: null, profile: null };
|
|
13
|
+
let user = { id: "user-a", username: "alice" };
|
|
14
|
+
let pending = null;
|
|
15
|
+
const convex = { url: "http://127.0.0.1:3540" };
|
|
16
|
+
mock.module("@convex-dev/auth/react", () => ({ useAuthToken: () => token }));
|
|
17
|
+
mock.module("convex/browser", () => ({
|
|
18
|
+
ConvexHttpClient: class {
|
|
19
|
+
setAuth() {}
|
|
20
|
+
query(reference) {
|
|
21
|
+
const name = getFunctionName(reference);
|
|
22
|
+
return pending
|
|
23
|
+
? pending[name]
|
|
24
|
+
: Promise.resolve(name === "auth:account" ? account : user);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
}));
|
|
28
|
+
mock.module("convex/react", () => ({
|
|
29
|
+
useConvex: () => convex,
|
|
30
|
+
useConvexAuth: () => ({ isAuthenticated: authenticated, isLoading: loading }),
|
|
31
|
+
useQuery: () => undefined,
|
|
32
|
+
useAction: () => async () => ({
|
|
33
|
+
balance: 42,
|
|
34
|
+
hasMonthlyPlan: false,
|
|
35
|
+
checkoutNeedsReview: false,
|
|
36
|
+
customerId: "user-a",
|
|
37
|
+
}),
|
|
38
|
+
}));
|
|
39
|
+
mock.module("@tanstack/react-router", () => ({
|
|
40
|
+
createFileRoute: () => (config) => config,
|
|
41
|
+
}));
|
|
42
|
+
mock.module("../../disposabl-kit/features", () => ({ paymentsEnabled: true }));
|
|
43
|
+
const { Pricing } = await import("../../disposabl-kit/client/routes/pricing");
|
|
44
|
+
let renderer;
|
|
45
|
+
const render = async () =>
|
|
46
|
+
act(async () => {
|
|
47
|
+
renderer = create(createElement(Pricing));
|
|
48
|
+
});
|
|
49
|
+
const refresh = async () =>
|
|
50
|
+
act(async () => {
|
|
51
|
+
renderer.update(createElement(Pricing));
|
|
52
|
+
});
|
|
53
|
+
const text = () => JSON.stringify(renderer.toJSON());
|
|
54
|
+
afterEach(async () => {
|
|
55
|
+
await act(async () => renderer?.unmount());
|
|
56
|
+
token = jwt("alice");
|
|
57
|
+
authenticated = true;
|
|
58
|
+
loading = false;
|
|
59
|
+
account = { username: "alice", email: null, profile: null };
|
|
60
|
+
user = { id: "user-a", username: "alice" };
|
|
61
|
+
pending = null;
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test("shows the authenticated account and retains anonymous pricing", async () => {
|
|
65
|
+
await render();
|
|
66
|
+
expect(text()).toContain("Signed in as");
|
|
67
|
+
expect(text()).toContain("alice");
|
|
68
|
+
authenticated = false;
|
|
69
|
+
token = null;
|
|
70
|
+
await refresh();
|
|
71
|
+
expect(text()).toContain("Sign in");
|
|
72
|
+
expect(text()).not.toContain("alice");
|
|
73
|
+
expect(text()).not.toContain("Signed in as");
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test("does not show a prior account while switching or after an old response", async () => {
|
|
77
|
+
await render();
|
|
78
|
+
let resolveAccount, resolveUser;
|
|
79
|
+
pending = {
|
|
80
|
+
"auth:account": new Promise((resolve) => {
|
|
81
|
+
resolveAccount = resolve;
|
|
82
|
+
}),
|
|
83
|
+
"users/index:current": new Promise((resolve) => {
|
|
84
|
+
resolveUser = resolve;
|
|
85
|
+
}),
|
|
86
|
+
};
|
|
87
|
+
token = jwt("bob");
|
|
88
|
+
await refresh();
|
|
89
|
+
expect(text()).toContain("Loading your account");
|
|
90
|
+
expect(text()).not.toContain("alice");
|
|
91
|
+
token = jwt("charlie");
|
|
92
|
+
pending = null;
|
|
93
|
+
account = { username: "charlie", email: null, profile: null };
|
|
94
|
+
user = { id: "user-c", username: "charlie" };
|
|
95
|
+
await refresh();
|
|
96
|
+
expect(text()).toContain("charlie");
|
|
97
|
+
await act(async () => {
|
|
98
|
+
resolveAccount({ username: "bob", email: null, profile: null });
|
|
99
|
+
resolveUser({ id: "user-b", username: "bob" });
|
|
100
|
+
});
|
|
101
|
+
expect(text()).toContain("charlie");
|
|
102
|
+
expect(text()).not.toContain("bob");
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
test("reports identity lookup failure without inventing a label", async () => {
|
|
106
|
+
pending = {
|
|
107
|
+
"auth:account": Promise.reject(new Error("offline")),
|
|
108
|
+
"users/index:current": Promise.resolve(user),
|
|
109
|
+
};
|
|
110
|
+
await render();
|
|
111
|
+
expect(text()).toContain("Your account could not be loaded");
|
|
112
|
+
expect(text()).not.toContain("Signed in as");
|
|
113
|
+
});
|