[tauri] KeepHerSafeApps: App words for Keep her safe, and Android's own save screen through a narrow bridge

This commit is contained in:
2026-11-17 20:31:35 +01:00
parent 0b72ae05a2
commit 3c4463dbdd
9 changed files with 341 additions and 13 deletions
+43
View File
@@ -229,6 +229,49 @@ describe('keep her safe (keep-her-safe.md)', () => {
await waitFor(() => expect(document.getElementById('rose-numbers')?.textContent).toContain(`${en.rose.daysOfCare}1`));
});
it('in an app, says where she lives and asks no browser, which is not there (keep-her-safe-apps.md A1)', async () => {
const persisted = vi.fn(async () => false);
const persist = vi.fn(async () => false);
render(Rose, { wiring: wiring({ keeping: { where: 'app', persisted, persist }, installHint: true }), timeZone: ZONE });
await open();
expect(await screen.findByText(en.rose.safe.app)).toBeTruthy();
for (const said of [en.rose.safe.mayClear, en.rose.safe.unknown, en.rose.safe.kept, en.rose.safe.install]) {
expect(screen.queryByText(said)).toBeNull();
}
expect(screen.queryByRole('button', { name: en.rose.safe.ask })).toBeNull();
expect(screen.getByRole('button', { name: en.rose.safe.save })).toBeTruthy();
expect(screen.getByLabelText(en.rose.safe.bringBack)).toBeTruthy();
expect(persisted).not.toHaveBeenCalled();
expect(persist).not.toHaveBeenCalled();
});
it('the app words never speak of a browser', () => {
expect(en.rose.safe.app).not.toMatch(/browser/i);
expect(en.rose.safe.saved).not.toMatch(/browser/i);
});
it('says she is in the file only when the app knows it was written (A4)', async () => {
let answer = true;
render(Rose, { wiring: wiring({ saveFile: async () => answer }), timeZone: ZONE });
await open();
const save = screen.getByRole('button', { name: en.rose.safe.save });
await fireEvent.click(save);
expect(await screen.findByText(en.rose.safe.saved)).toBeTruthy();
// A second save the player steps back from: the earlier word goes, and nothing is said.
answer = false;
await fireEvent.click(save);
await waitFor(() => expect(screen.queryByText(en.rose.safe.saved)).toBeNull());
});
it('a browser download says nothing of its own: the browser shows it', async () => {
const w = wiring();
render(Rose, { wiring: w, timeZone: ZONE });
await open();
await fireEvent.click(screen.getByRole('button', { name: en.rose.safe.save }));
await waitFor(() => expect(w.saved).toHaveLength(1));
expect(screen.queryByText(en.rose.safe.saved)).toBeNull();
});
it('a file that is not a rose is said calmly, and nothing changes', async () => {
const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined);
render(Rose, { wiring: wiring({ importRose: () => Promise.reject(new TypeError('storage: this file does not hold a rose')) }), timeZone: ZONE });