import assert from 'node:assert/strict';
import test from 'node:test';

import { isProductKey } from './productKey';

void test('isProductKey: legacy DND prefix', () => {
  assert.equal(isProductKey('DND-CEBEC1BF-AD0B-4312-BFDD-675AFF5955FD'), true);
});

void test('isProductKey: TTRPG prefix', () => {
  assert.equal(isProductKey('TTRPG-CEBEC1BF-AD0B-4312-BFDD-675AFF5955FD'), true);
});

void test('isProductKey: token with dot — no', () => {
  assert.equal(isProductKey('eyJ.xxx'), false);
});

void test('isProductKey: trimmed', () => {
  assert.equal(isProductKey('  TTRPG-CEBEC1BF-AD0B-4312-BFDD-675AFF5955FD  '), true);
});
