forwardemail / forwardemail/supertest

Looping, get() issues

Open
#455 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
14.4k
Forks
782
PR merge metrics
No merged PRs in 30d

Description

Hi, I have been trying to solve this without success. This are my two test:

it('Responds to route /123', function(done) {
request(server)
.get('/123')
.expect(200, done);
}); // Test fails because route does not exists which is expected

it('Responds to route /create-account', function(done) {
request(server)
.get('/create-account')
.expect(200, done);
}); // Test ok as expected

Then I created an array

var routes = ['/123', '/create-account'];

and I looped

for (var counter = 0; counter < routes.length; counter += 1) {
var route = routes[counter];

it('Responds to route ' + route, function(done) {
request(server)
.get(route)
.expect(200, done);
});
};

Result
- first iteration: test ok, which is not expected (?)
- second iteration: test ok, which is expected

I don't see what I am doing wrong, any help apprichiated.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.