33 lines
1.9 KiB
TypeScript
33 lines
1.9 KiB
TypeScript
// docs/console-parity.md is the parity checklist of the desktop against App Store Connect and Play Console: every row
|
|
// is edited in the window ("Edit" yes) or names its reason, no row is left as an open gap, and every desktop method a
|
|
// row names exists in the sidecar (so a renamed or removed method cannot leave the table claiming a write).
|
|
import { describe, expect, test } from 'bun:test';
|
|
import { readFileSync } from 'node:fs';
|
|
import { join } from 'node:path';
|
|
import { describeMethods } from '../cli/serve';
|
|
|
|
const DOC = readFileSync(join(import.meta.dir, '..', 'docs', 'console-parity.md'), 'utf8');
|
|
const rows = DOC.split('\n').filter(l => /^\| /.test(l) && !/^\| (Console screen|What) \|/.test(l) && !/^\| ---/.test(l))
|
|
.map(l => l.slice(2, -2).split(' | ').map(c => c.trim()));
|
|
|
|
describe('console parity checklist', () => {
|
|
test('every row: edited in the window, or the reason why not', () => {
|
|
expect(rows.length).toBeGreaterThan(60);
|
|
for (const r of rows) {
|
|
expect(r, r[0]).toHaveLength(6);
|
|
const [screen, , , edit, write, gap] = r as [string, string, string, string, string, string];
|
|
if (gap === 'none' || gap.startsWith('none ')) {
|
|
// nothing missing: edited (or nothing to edit) and written where the store has an API
|
|
expect(edit, screen).not.toBe('no');
|
|
expect(write, screen).not.toMatch(/^no\b/);
|
|
} else expect(gap, screen).toMatch(/^reason: \S/);
|
|
expect(gap, screen).not.toMatch(/no editor|not in the window$|not shown/);
|
|
}
|
|
});
|
|
test('the desktop methods the table names exist', () => {
|
|
const methods = new Set(describeMethods().map(m => m.method));
|
|
const named = [...DOC.matchAll(/`((?:apple|play|owner|project|listing|shots|reviews|prices|console|art)\.[a-z_]+)`/g)].map(m => m[1]!);
|
|
expect(named.length).toBeGreaterThan(20);
|
|
for (const m of new Set(named)) expect(methods.has(m), m).toBe(true);
|
|
});
|
|
});
|