'use strict'
import nock from 'nock'

import { EventCategory, EventComponent } from '../../src/dto/shared.dto'

import { expect } from 'chai'
import { metrics } from '../../src/metrics'

describe('CommonNetworkMember', () => {
  const params = {
    link:        'some_hsash_from_did',
    name:        'Did Created',
    category:    EventCategory.DID,
    subCategory: 'registry',
    component:   EventComponent.AffinityWalletExpoSDK
  }

  it('#send', async() => {
    nock('https://affinity-metrics.dev.affinity-project.org')
      .post('/api/v1/events/createEvent')
      .reply(200, { name: 'Mocked Event' })

    const response = await metrics.send(params, 'test-api-key')

    expect(response).to.exist
    expect(response.name).to.be.equal('Mocked Event')
  })
})
