UNPKG

unqommented

Version:

A Node.js utility that quickly identifies files with uncommented code in your codebase. Designed for developers who want to efficiently tell LLMs exactly which files need comments added.

25 lines (21 loc) 795 B
require('qtests/setup'); const { test, expect, describe } = require('@jest/globals'); const utils = require('../utils'); const localVars = require('../../config/localVars'); describe('generateId uniqueness', () => { test('should produce unique hexadecimal ids', () => { const ids = new Set(); for (let i = 0; i < 100; i += 1) { const id = utils.generateId(); expect(id).toMatch(/^[a-f0-9]+$/); ids.add(id); } expect(ids.size).toBe(100); }); test('should throw for non-integer length', () => { expect(() => utils.generateId(3.5)).toThrow(localVars.ERROR_MESSAGES.LENGTH_NOT_POSITIVE); }); test('should throw for NaN length', () => { expect(() => utils.generateId(Number.NaN)).toThrow(localVars.ERROR_MESSAGES.LENGTH_NOT_POSITIVE); }); });