import { test } from '@japa/runner'
import { CertificateFile, CertificateFileKind } from '../../../../src/index.js'

test.group('CertificateFile.fromName()', () => {
  test('sets the kind', ({ assert }) => {
    const result = CertificateFile.fromName('name')
    assert.equal(result.kind, CertificateFileKind)
  })

  test('sets the name', ({ assert }) => {
    const result = CertificateFile.fromName('name')
    assert.equal(result.info.name, 'name')
  })

  test('sets the key', ({ assert }) => {
    const result = CertificateFile.fromName('name')
    assert.typeOf(result.key, 'string')
    assert.notEqual(result.key, '')
  })
})
