Skip to content

Test stops after when use authenticatedSession #33

@kazkondo

Description

@kazkondo
const session = require('supertest-session');
const myApp = require('../../app');

describe('Test sample', () => {

  let testSession;
  let authenticatedSession;

  beforeEach( () => {
    testSession = session(myApp);
  });

  it('/member/login', (done) => {
    testSession.post('/member/login')
      .send({ userid: 'test@example.com', password: 'test' })
      .expect(302)
      .end(function (err) {
        if (err) { return done(err); }
        authenticatedSession = testSession;
        return done();
      });
  });

  // if there is this test, test freezes after all test suite finished
  it('/member/profile', (done) => {
    authenticatedSession.get('/member/profile')
      .expect(200)
      .end(done); 
  });
});

Written by Typescript, but executed as javascript with jest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions