Skip to content

Instantly share code, notes, and snippets.

@reke592
Created November 7, 2021 13:58
Show Gist options
  • Save reke592/d4ffc15966c8c56e9c04f718a2d20264 to your computer and use it in GitHub Desktop.
Save reke592/d4ffc15966c8c56e9c04f718a2d20264 to your computer and use it in GitHub Desktop.

Revisions

  1. reke592 created this gist Nov 7, 2021.
    36 changes: 36 additions & 0 deletions sample-dropdown-option-test.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    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)
    })
    ]))
    });
    });

    });