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

Error: expect(received).toBe(expected) // Object.is equality #49

Open
preyask-scalex opened this issue Jan 24, 2022 · 0 comments
Open

Comments

@preyask-scalex
Copy link

I have written an API to sign-in which works perfectly fine on Postman. Have written a test for the same but the test fails. Attaching the error and test written. Please provide a solution for same.

'use strict';

// tests for view_sneaker_room
// Generated by serverless-jest-plugin

const mod = require('./../src/routes/sign_in');

const jestPlugin = require('serverless-jest-plugin');
const lambdaWrapper = jestPlugin.lambdaWrapper;
const wrapped = lambdaWrapper.wrap(mod, { handler: 'handler' });
const testUserEmail = 'mark1@yopmail.com';
const testPassword= 'Admin@123';
jest.setTimeout(30000);

describe('signIn', () => {
  beforeAll((done) => {
//  lambdaWrapper.init(liveFunction); // Run the deployed lambda

    done();
  });

  // it('verify response', () => {
  //   return wrapped.run({ queryStringParameters: { email: testUserEmail, password: testPassword} }).then((response) => {
  //     expect(response).toBeDefined();
  //   });
  // });
  it('200 works', () => {
    return wrapped.run({ queryStringParameters: { email: testUserEmail,password: testPassword} }).then((response) => {
      console.log("response :",response)
      expect(response.statusCode).toBe(200);
      expect(typeof response.body).toBe('string');
      expect(response.headers['Content-Type']).toBe('application/json');
    });
  });
});

image
image

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