Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: remove redundant checks for UUID version and variant bits
  • Loading branch information
nabeel378 committed Apr 2, 2026
commit 87dd2ac0d3f88e1c7cb31f14673d2b67535a74cd
7 changes: 0 additions & 7 deletions test/parallel/test-crypto-randomuuidv7.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const {
randomUUIDv7,
} = require('crypto');

// Basic return type and format checks.
{
const uuid = randomUUIDv7();
assert.strictEqual(typeof uuid, 'string');
Expand All @@ -23,22 +22,18 @@ const {
);
}

// Check version and variant bits.
{
const uuid = randomUUIDv7();

// Version 7: byte 6 high nibble should be 0x7.
assert.strictEqual(
Buffer.from(uuid.slice(14, 16), 'hex')[0] & 0xf0, 0x70,
);

// Variant: byte 8 high 2 bits should be 0b10.
assert.strictEqual(
Buffer.from(uuid.slice(19, 21), 'hex')[0] & 0b1100_0000, 0b1000_0000,
);
}

// Uniqueness: generate many UUIDs and verify no duplicates.
{
const seen = new Set();
for (let i = 0; i < 1000; i++) {
Expand All @@ -64,8 +59,6 @@ const {
assert(timestamp <= after, `Timestamp ${timestamp} > after ${after}`);
}

// Monotonicity: UUIDs generated in sequence should sort lexicographically
// within the same millisecond or across milliseconds.
{
let prev = randomUUIDv7();
for (let i = 0; i < 100; i++) {
Expand Down