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

import { resolveRouteErrorLogLevel } from './http.js'

test('expected worker session expiry is debug-level', () => {
  assert.equal(
    resolveRouteErrorLogLevel({ statusCode: 401, errorCode: 'worker_auth_expired' }),
    'debug',
  )
  assert.equal(
    resolveRouteErrorLogLevel({ statusCode: 401, errorCode: 'worker_auth_invalid' }),
    'warn',
  )
  assert.equal(resolveRouteErrorLogLevel({ statusCode: 500, errorCode: 'internal_error' }), 'error')
})
