Skip to content

Commit

Permalink
test: add test to validate status type
Browse files Browse the repository at this point in the history
  • Loading branch information
johge201 committed May 12, 2022
1 parent 077902d commit fe04821
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/internet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,28 @@ describe('internet', () => {
expect(statusCode).toBeTypeOf('number');
expect(statusCode).toBeLessThanOrEqual(600);
});

it('should return a correct status code for multiple classes', () => {
const statusCode = faker.internet.statusCode({
types: ['success', 'redirection'],
});

expect(statusCode).toBeTruthy();
expect(statusCode).toBeTypeOf('number');
expect(statusCode).toBeGreaterThanOrEqual(200);
expect(statusCode).toBeLessThan(400);
});

it('should return a correct status code for a single class', () => {
const statusCode = faker.internet.statusCode({
types: ['serverError'],
});

expect(statusCode).toBeTruthy();
expect(statusCode).toBeTypeOf('number');
expect(statusCode).toBeGreaterThanOrEqual(500);
expect(statusCode).toBeLessThan(600);
});
});
}
});
Expand Down

0 comments on commit fe04821

Please sign in to comment.