<commit_before>import { should, expect } from 'chai'
import { ApiGateway } from '../src/index.js'

describe('api-gateway decorator', () => {
  before(() => {
    should()
    expect()
  })

  describe('when applied to a class method', () => {
    beforeEach(() => {

    })

    it('should work with no parameters', (done) => {
      class Test {
        @ApiGateway()
        testMethod(event) {
          return Promise.resolve(event.test)
        }
      }

      const test = new Test()

      test.testMethod({ test: 'test string' }, null, (err, res) => {
        res.should.be.an('object')

        res.should.have.property('headers')
        res.should.have.property('statusCode')
        res.should.have.property('body')

        res.statusCode.should.equal(200)
        res.headers.should.eql({})
        res.body.should.equal('test string')

        done()
      })
    })

    it('should return a status code of 500 for an unknown exception', (done) => {
      class Test {
        @ApiGateway()<commit_msg>gateway test to validate json body<commit_after>import { should, expect } from 'chai'
import { ApiGateway } from '../src/index.js'

describe('api-gateway decorator', () => {
  before(() => {
    should()
    expect()
  })

  describe('when applied to a class method', () => {
    it('should work with no parameters', (done) => {
      class Test {
        @ApiGateway()
        testMethod(event) {
          return Promise.resolve(event.test)
        }
      }

      const test = new Test()

      test.testMethod({ test: 'test string' }, null, (err, res) => {
        res.should.be.an('object')

        res.should.have.property('headers')
        res.should.have.property('statusCode')
        res.should.have.property('body')

        res.statusCode.should.equal(200)
        res.headers.should.eql({})
        res.body.should.equal('"test string"')

        done()
      })
    })

    it('should return a status code of 500 for an unknown exception', (done) => {
      class Test {
        @ApiGateway()
{'fraction_non_alphanumeric': 0.15688209176122347, 'fraction_numerical': 0.0059200789343857915, 'mean_word_length': 2.270967741935484, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5598664', 'n_tokens_mistral': 625, 'n_tokens_neox': 604, 'n_words': 139}