const { test } = require('node:test')
const assert = require('node:assert/strict')
const updateBannersCommand = require('./update-banners')

test('updateBannersCommand exits when app id is missing', async () => {
  let exitCode
  const originalExit = process.exit
  process.exit = (code) => {
    exitCode = code
    throw new Error('process.exit')
  }

  try {
    await assert.rejects(
      () => updateBannersCommand('hero', { appId: null }),
      /process\.exit/,
    )
    assert.equal(exitCode, 1)
  } finally {
    process.exit = originalExit
  }
})
