neutral names in docs, tests and comments (no real app or project names)

This commit is contained in:
CRTkafa 2026-10-16 06:14:02 +08:00
parent cba4660777
commit 6443a5c442
7 changed files with 28 additions and 28 deletions

View file

@ -66,7 +66,7 @@ describe('credentials: one machine, many projects', () => {
writeFileSync(join(creds, 'default.json'), JSON.stringify({ ASC_KEY_ID: 'DEFAULT000', ASC_ISSUER_ID: 'iss', ASC_P8: PEM('x') }));
expect(defaultProfile()).toBe('teamB');
// the project's own keys beat the pointer; a profile the project names beats both; env beats all
const a = project(base, 'Star Dash');
const a = project(base, 'star-dash');
expect(ascKey(a).keyId).toBe('ABCDE12345');
const file = join(a, '.storebound', 'credentials.json');
writeFileSync(file, JSON.stringify({ ...JSON.parse(readFileSync(file, 'utf8')), account: 'teamA' }));
@ -84,7 +84,7 @@ describe('credentials: one machine, many projects', () => {
}));
test('project-only values from the project, store keys from the profile, env over everything', () => machine(({ creds, base }) => {
const a = project(base, 'Star Dash');
const a = project(base, 'star-dash');
// the project's own keys work without any profile
expect(ascKey(a).keyId).toBe('ABCDE12345');
mkdirSync(creds, { recursive: true });
@ -113,7 +113,7 @@ describe('credentials: one machine, many projects', () => {
}));
test('accounts import: two projects with the same Apple key and Play account -> one profile, 0600 files, projects stay valid', () => machine(({ creds, base }) => {
const a = project(base, 'Star Dash'), b = project(base, 'a game');
const a = project(base, 'star-dash'), b = project(base, 'demo-game');
const dry = planImport(a);
expect(dry.profile).toBe('default');
expect(dry.reuse).toBe(false);
@ -136,7 +136,7 @@ describe('credentials: one machine, many projects', () => {
const projA = JSON.parse(readFileSync(join(a, '.storebound', 'credentials.json'), 'utf8'));
expect(projA.account).toBe('default');
expect(projA.ASC_KEY_ID).toBeUndefined();
expect(projA.ANDROID_KEYSTORE).toBe('Star Dash.jks');
expect(projA.ANDROID_KEYSTORE).toBe('star-dash.jks');
expect(ascKey(a).pem).toContain('apple-secret-sentinel');
expect(playServiceAccount(a).client_email).toBe('release@example.com');
// the second project with the same account: the same profile, its files unchanged
@ -145,7 +145,7 @@ describe('credentials: one machine, many projects', () => {
expect(second.reuse).toBe(true);
expect(second.writes.filter(w => w.path.startsWith(creds)).map(w => w.action)).toEqual(['same']);
applyImport(second);
expect(JSON.parse(readFileSync(join(b, '.storebound', 'credentials.json'), 'utf8')).ANDROID_KEYSTORE_PASSWORD).toBe('a game-pw');
expect(JSON.parse(readFileSync(join(b, '.storebound', 'credentials.json'), 'utf8')).ANDROID_KEYSTORE_PASSWORD).toBe('demo-game-pw');
expect(ascKey(b).keyId).toBe('ABCDE12345');
// running it again changes nothing
expect(planImport(b).writes.every(w => w.action === 'same')).toBe(true);
@ -157,13 +157,13 @@ describe('credentials: one machine, many projects', () => {
expect(third.profile).toBe('other-studio');
applyImport(third);
expect(ascKey(c).keyId).toBe('ZZZZZ99999');
expect(ascKey(a).keyId).toBe('ABCDE12345'); // "account": "default" still points Star Dash at its own
expect(ascKey(a).keyId).toBe('ABCDE12345'); // "account": "default" still points star-dash at its own
expect(useProfile(c, 'default')).toContain('credentials.json');
expect(() => useProfile(c, 'missing')).toThrow(/no profile/);
}));
test('the import command prints paths and names, never key values', () => machine(({ base }) => {
const a = project(base, 'Star Dash');
const a = project(base, 'star-dash');
const r = Bun.spawnSync(['bun', join(ROOT, 'cli', 'index.ts'), 'accounts', 'import', '--dry', '--dir', a], { env: { ...process.env, STOREBOUND_NO_NETWORK: '1' } });
const out = r.stdout.toString() + r.stderr.toString();
expect(r.exitCode).toBe(0);
@ -179,14 +179,14 @@ describe('credentials: one machine, many projects', () => {
describe('the machine\'s app folder list', () => {
test('add, re-add, remove; ids are the desktop export ids; bad entries are dropped', () => machine(({ base }) => {
const r0 = { version: 1 as const, projects: [] };
const { registry, added } = withFolder(r0, '/w/Star Dash', 'Star Dash', 't');
const { registry, added } = withFolder(r0, '/w/star-dash', 'Star Dash', 't');
expect(added).toBe(true);
expect(registry.projects[0]!.id).toBe(desktopProjectId('/w/Star Dash'));
expect(withFolder(registry, '/w/Star Dash/', undefined, 't').added).toBe(false);
expect(withoutFolder(registry, folderId('/w/Star Dash')).removed?.name).toBe('Star Dash');
expect(registry.projects[0]!.id).toBe(desktopProjectId('/w/star-dash'));
expect(withFolder(registry, '/w/star-dash/', undefined, 't').added).toBe(false);
expect(withoutFolder(registry, folderId('/w/star-dash')).removed?.name).toBe('Star Dash');
expect(parseRegistry('{"projects":[{"path":"relative"},{"path":"/a","id":"zz"},{"path":"/a"}]}').projects.map(p => [p.path, p.id])).toEqual([['/a', folderId('/a')]]);
expect(parseRegistry('not json').projects).toEqual([]);
const dir = project(base, 'a game');
const dir = project(base, 'demo-game');
expect(addFolder(dir).added).toBe(true);
expect(addFolder(dir).added).toBe(false);
expect(readRegistry().projects.map(p => p.path)).toEqual([dir]);