Skip to content

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

@preyask-scalex

Description

@preyask-scalex

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions