Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app.listen is not a function #40

Closed
rob4629 opened this issue Mar 23, 2020 · 1 comment
Closed

app.listen is not a function #40

rob4629 opened this issue Mar 23, 2020 · 1 comment

Comments

@rob4629
Copy link

rob4629 commented Mar 23, 2020

I'm investigating hippie-swagger for building out a backend automation framework. I'm trying to pass in the URL for an API, but get the error app.listen is not a function.

Here's my code

const hippie = require('hippie-swagger');
const path = require('path');
const SwaggerParser = require('swagger-parser');

const baseApi = 'http:https://api.local:4000'
let dereferencedSwagger;
const swaggerPath = '../resources/payments.swagger.json';

function parseSwaggerDoc(swaggerDoc) {
  const swaggerPath = path.join(__dirname, swaggerDoc);
  return SwaggerParser.dereference(swaggerPath);
}

describe('Payments API PoC', () => {
  before(async () => {
    dereferencedSwagger = parseSwaggerDoc(swaggerPath);
  })

  describe('Payments Swagger', () => {
    it('works when the request matches the swagger file', done => {
      hippie(baseApi, dereferencedSwagger)
        .get('/')
        .pathParams({
          tagId: 1
        })
        .expectStatus(200)
        .end(done)
    })
  })
})

Test output:

  Payments API PoC
    Payments Swagger
      1) works when the request matches the swagger file

  0 passing (38ms)
  1 failing

  1) Payments API PoC
       Payments Swagger
         works when the request matches the swagger file:
     TypeError: app.listen is not a function
      at Client.app (node_modules/hippie/lib/hippie/client.js:412:30)
      at new Client (node_modules/hippie/lib/hippie/client.js:39:17)
      at Client (node_modules/hippie/lib/hippie/client.js:26:41)
      at module.exports (node_modules/hippie-swagger/lib/hippie-swagger.js:34:13)
      at Context.done (tests/payments_swagger.js:18:7)
@rob4629
Copy link
Author

rob4629 commented Mar 23, 2020

Sorry.... just after opening this I found this closed issue. Closing this as a duplicate, as it's resolved my problem

@rob4629 rob4629 closed this as completed Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant