service-spec.ts 696 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
import { validators } from '../dist'
import { BaseServiceV2 } from '../src'

type ServiceOptions = {
  camelCase: string
}

class Service extends BaseServiceV2<ServiceOptions, {}, {}> {
  constructor(options?: Partial<ServiceOptions>) {
    super({
      name: 'test-service',
      version: '0.0',
      options,
      optionsSpec: {
        camelCase: { validator: validators.str, desc: 'test' },
      },
      metricsSpec: {},
    })
  }
  protected async main() {
    /* eslint-disable @typescript-eslint/no-empty-function */
  }
}

describe('BaseServiceV2', () => {
  it('base service ctor does not throw on camel case options', async () => {
    new Service({ camelCase: 'test' })
  })
})