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

import { buildConsumeCallbackBizParams } from './consume-callback-service.js'

test('buildConsumeCallbackBizParams omits unsupported consume fields', () => {
  const bizParams = buildConsumeCallbackBizParams({
    oid: '2619000086068982',
    etickets: [
      {
        id: 'KSVASXT6Q955WT4SS36',
        num: 1,
        status: 'CONSUMED',
      } as any,
    ],
    status: 'CONSUMED',
    consumeType: 'consume',
    consumeTime: 1783596649024,
    eticketType: 'DINING_OPEN_TICKET',
    token: 'ticket-token',
    seriallNum: 'CONSUME-KSVASXT6Q955WT4SS36',
  } as any)

  assert.deepEqual(bizParams.etickets, [
    {
      id: 'KSVASXT6Q955WT4SS36',
      num: 1,
    },
  ])
  assert.equal(bizParams.consumeType, 'consume')
  assert.equal('eticketType' in bizParams, false)
})
