import { describe, it } from 'node:test';
import assert from 'node:assert/strict';
import { maskVendorCode } from './vendor-code-mask.js';
describe('maskVendorCode (issue #1296 — extracted from billing-vendor-codes-routes + runtime-link-routes)', () => {
    it('masks a full 14-char suffix to first-4 + last-4 with ellipsis', () => {
        assert.equal(maskVendorCode('cxni_v1_abcdefghijklmn'), 'cxni_v1_abcd...klmn');
    });
    it('returns the full code when the suffix is <= 8 chars (nothing to mask)', () => {
        assert.equal(maskVendorCode('cxni_v1_short'), 'cxni_v1_short');
        assert.equal(maskVendorCode('cxni_v1_12345678'), 'cxni_v1_12345678');
    });
    it('falls back to first-8 + ellipsis for non-standard prefixes', () => {
        assert.equal(maskVendorCode('legacy-style-vendor-code-xyz'), 'legacy-s...');
        assert.equal(maskVendorCode('short'), 'short...');
    });
    it('is pure — same input always yields same output', () => {
        const input = 'cxni_v1_repeatable000xy';
        assert.equal(maskVendorCode(input), maskVendorCode(input));
    });
    it('does not leak the middle of the suffix', () => {
        const masked = maskVendorCode('cxni_v1_SECRETSECRETzz');
        assert.ok(!masked.includes('SECRET'), 'middle of suffix must be redacted');
        assert.ok(masked.startsWith('cxni_v1_SECR'), 'first 4 chars preserved');
        assert.ok(masked.endsWith('Tzz'), 'last 4 chars preserved (Tzz from "ETzz")');
    });
});
//# sourceMappingURL=vendor-code-mask.test.js.map