Skip to content

Server tests : Authentication in Mocha + Chai + Sinon #2168

Closed
@JulienMalige

Description

@JulienMalige

I can't find a solution to run integration tests under authentication.

Is the Chai .auth('user', 'pass') working ?

    beforeEach(function(done) {
      request(app)
        .get('/api/searches')
        .auth('test@example.com', 'test')
        .expect(200)
        .expect('Content-Type', /json/)
        .end((err, res) => {
          if (err) {
            return done(err);
          }
          searchs = res.body;
          done();
        });
    });
Item Version
generator-angular-fullstack 3.7.6
Item Answer
Transpiler Babel
Markup HTML
CSS SCSS
Router ui-router
Client Tests Mocha
DB MongoDB
Auth Y

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions