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

import { resolveAccessLogLevel } from './access-log.js'

test('resolveAccessLogLevel sends successful reads to debug', () => {
  assert.equal(resolveAccessLogLevel('GET', 200), 'debug')
  assert.equal(resolveAccessLogLevel('head', 304), 'debug')
})

test('resolveAccessLogLevel keeps writes and failures at info', () => {
  assert.equal(resolveAccessLogLevel('POST', 200), 'info')
  assert.equal(resolveAccessLogLevel('GET', 404), 'info')
  assert.equal(resolveAccessLogLevel('GET', 500), 'info')
})
