Some checks are pending
CI / validate (push) Waiting to run
Phase 2 des cards→wordeck Big-Bang-Rebrand:
- 4 package.json: @cards/* → @wordeck/*
- packages/cards-domain/ → packages/wordeck-domain/
- 41+12 Files: from '@cards/domain' → '@wordeck/domain'
- pgSchema('cards') → pgSchema('wordeck') (Drizzle-Schema)
- 17 Files: process.env.CARDS_* → process.env.WORDECK_*
- docker-compose Service-Names: cards-* → wordeck-*
- docker-compose Volume: /Volumes/ManaData/cards → wordeck
- env-vars in compose: CARDS_DB_PASSWORD/_API_VERSION/_DSGVO_SERVICE_KEY etc. → WORDECK_*
- Log-Prefixes + Error-Strings + manifest-id 'cards' → 'wordeck'
- CORS-Origin cardecky.mana.how → wordeck.com
- .env.production.example umbenannt + S3-Key entfernt (kein MinIO mehr)
Type-Check 0 Errors in api+domain+web, 51/51 Domain-Tests grün.
DB-Rename + Container/Volume-Rename auf mana-server folgen in nächstem
Commit nach Verzeichnis-Rename.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
61 lines
1.6 KiB
TypeScript
61 lines
1.6 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
|
|
import { cardContentHash } from '../src/content-hash.ts';
|
|
|
|
describe('cardContentHash', () => {
|
|
it('liefert deterministischen 64-char-hex-String (SHA-256)', async () => {
|
|
const h = await cardContentHash({
|
|
type: 'basic',
|
|
fields: { front: 'Q', back: 'A' },
|
|
});
|
|
expect(h).toMatch(/^[0-9a-f]{64}$/);
|
|
});
|
|
|
|
it('ist invariant gegenüber Field-Reihenfolge', async () => {
|
|
const a = await cardContentHash({
|
|
type: 'basic',
|
|
fields: { front: 'Q', back: 'A' },
|
|
});
|
|
const b = await cardContentHash({
|
|
type: 'basic',
|
|
fields: { back: 'A', front: 'Q' },
|
|
});
|
|
expect(a).toBe(b);
|
|
});
|
|
|
|
it('unterscheidet basic und basic-reverse', async () => {
|
|
const a = await cardContentHash({
|
|
type: 'basic',
|
|
fields: { front: 'Q', back: 'A' },
|
|
});
|
|
const b = await cardContentHash({
|
|
type: 'basic-reverse',
|
|
fields: { front: 'Q', back: 'A' },
|
|
});
|
|
expect(a).not.toBe(b);
|
|
});
|
|
|
|
it('unterscheidet zwei Cloze-Karten mit unterschiedlichem Cluster-Markup', async () => {
|
|
const a = await cardContentHash({
|
|
type: 'cloze',
|
|
fields: { text: 'Die {{c1::Hauptstadt}} ist {{c2::Paris}}.' },
|
|
});
|
|
const b = await cardContentHash({
|
|
type: 'cloze',
|
|
fields: { text: 'Die Hauptstadt ist {{c1::Paris}}.' },
|
|
});
|
|
expect(a).not.toBe(b);
|
|
});
|
|
|
|
it('unterscheidet Karten mit Whitespace-Drift', async () => {
|
|
const a = await cardContentHash({
|
|
type: 'basic',
|
|
fields: { front: 'Q', back: 'A' },
|
|
});
|
|
const b = await cardContentHash({
|
|
type: 'basic',
|
|
fields: { front: 'Q ', back: 'A' },
|
|
});
|
|
expect(a).not.toBe(b);
|
|
});
|
|
});
|