tududi/backend/tests/unit/utils/uid.test.js
Chris 3486541272
Add comprehensive LLM development documentation (#939)
* Increase coverage

* Add comprehensive LLM development documentation

- Add CLAUDE.md as main documentation index
- Create 8 detailed documentation files in docs/:
  - architecture.md: Tech stack, data models, auth system
  - directory-structure.md: Complete file tree with paths
  - backend-patterns.md: Module architecture and patterns
  - database.md: Models, migrations, and workflows
  - development-workflow.md: Setup and daily development
  - code-conventions.md: Style guide and best practices
  - testing.md: Test organization and patterns
  - common-tasks.md: How-to guides for frequent tasks
- Update .gitignore to allow project-level CLAUDE.md
- 4,285 lines of comprehensive documentation
- Organized for easy navigation with cross-links
- LLM-optimized with absolute paths and code examples

* fixup! Add comprehensive LLM development documentation
2026-03-14 02:54:59 +02:00

29 lines
903 B
JavaScript

const { uid } = require('../../../utils/uid');
describe('uid utility', () => {
it('should return a string', () => {
const id = uid();
expect(typeof id).toBe('string');
});
it('should return a 15-character string', () => {
const id = uid();
expect(id).toHaveLength(15);
});
it('should generate different ids on successive calls', () => {
const ids = new Set();
for (let i = 0; i < 100; i++) {
ids.add(uid());
}
expect(ids.size).toBe(100);
});
it('should only contain characters from the allowed alphabet', () => {
// The allowed alphabet is '0123456789abcdefghijkmnpqrstuvwxyz'
// (no 'o' or 'l' to avoid ambiguity)
// Note: in test env nanoid is mocked, so this validates the mock contract
const id = uid();
expect(id).toMatch(/^[0-9a-z]+$/);
});
});