Created
November 7, 2021 13:58
-
-
Save reke592/d4ffc15966c8c56e9c04f718a2d20264 to your computer and use it in GitHub Desktop.
Sample dropdown option test case using supertest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const request = require('supertest'); | |
| const { app } = require('../server'); | |
| describe('Form input options', () => { | |
| it('GET /option/regions --> array public list regions', () => { | |
| return request(app) | |
| .get('/option/regions') | |
| .expect('Content-Type', /json/) | |
| .expect(200) | |
| .then(response => { | |
| return expect(response.body).toEqual(expect.arrayContaining([ | |
| expect.objectContaining({ | |
| name: expect.any(String) | |
| }) | |
| ])) | |
| }); | |
| }); | |
| it('GET /option/genders --> 200 array public list genders', () => { | |
| return request(app) | |
| .get('/option/genders') | |
| .expect('Content-Type', /json/) | |
| .expect(200) | |
| .then(response => { | |
| return expect(response.body).toEqual(expect.arrayContaining([ | |
| expect.objectContaining({ | |
| id: expect.any(Number), | |
| name: expect.any(String) | |
| }) | |
| ])) | |
| }); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment