15 lines
1.4 KiB
TypeScript
15 lines
1.4 KiB
TypeScript
// The App Review demo account (reviewDemoAccount, sent by apple review-details) must work on the live backend: a
|
|
// capture sign-in against a local stack that uses it gets a check note (a session nearly stored local-only creds there).
|
|
import { afterEach, expect, test } from 'bun:test';
|
|
import { run as check } from '../cli/check';
|
|
import { BASE, capture, jsonOut, project, restore } from './helpers/store-mock';
|
|
|
|
afterEach(restore);
|
|
const withAuth = (baseUrl: string, ref: string) => ({ ...BASE, play: undefined, shots: { capture: { baseUrl, auth: { request: { url: '/api/login', method: 'POST', body: { email: `\${cred:${ref}}`, password: `\${cred:${ref.replace('username', 'password').replace('email', 'password')}}` } } } } } }) as unknown as typeof BASE;
|
|
const notes = async (cfg: typeof BASE) => { const p = project(cfg, { '.gitignore': '.storebound/\n' }); const j = jsonOut((await capture(() => check(p.ctx(['--json'], ['json'])))).out); return JSON.stringify(j); };
|
|
|
|
test('local capture with reviewDemoAccount gets a note; captureAuth or a remote stack does not', async () => {
|
|
expect(await notes(withAuth('http://localhost:5173', 'reviewDemoAccount.username'))).toContain('captureAuth');
|
|
expect(await notes(withAuth('http://localhost:5173', 'email'))).not.toContain('signs in to a local stack');
|
|
expect(await notes(withAuth('https://staging.example.com', 'reviewDemoAccount.username'))).not.toContain('signs in to a local stack');
|
|
});
|