import test from 'node:test'; import assert from 'node:assert/strict'; import {basic} from '../dist/basic.js'; test('Basic preserves UTF-8 and colons in the password',()=>{ assert.deepEqual(basic('Basic '+Buffer.from('alice:пароль:extra').toString('base64')),['alice','пароль:extra']); }); test('malformed Basic and invalid UTF-8 fail before the KDF',()=>{ for(const h of [undefined,'Bearer abc','Basic YQ==','Basic YQA=','Basic ////','Basic Zg'])assert.throws(()=>basic(h),e=>e.statusCode===401); });