From 548498d37424f2ac579770962b627aeba61925e8 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Mon, 29 May 2023 14:48:50 -0700 Subject: added bot --- test/api.test.ts | 25 +++++++++++++++++++++++++ test/app.test.ts | 25 +++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 test/api.test.ts create mode 100644 test/app.test.ts (limited to 'test') diff --git a/test/api.test.ts b/test/api.test.ts new file mode 100644 index 0000000..2e94e6d --- /dev/null +++ b/test/api.test.ts @@ -0,0 +1,25 @@ +import request from 'supertest'; + +import app from '../src/app'; + +describe('GET /api/v1', () => { + it('responds with a json message', (done) => { + request(app) + .get('/api/v1') + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(200, { + message: 'API - 👋🌎🌍🌏', + }, done); + }); +}); + +describe('GET /api/v1/emojis', () => { + it('responds with a json message', (done) => { + request(app) + .get('/api/v1/emojis') + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(200, ['😀', '😳', '🙄'], done); + }); +}); diff --git a/test/app.test.ts b/test/app.test.ts new file mode 100644 index 0000000..c9f37c2 --- /dev/null +++ b/test/app.test.ts @@ -0,0 +1,25 @@ +import request from 'supertest'; + +import app from '../src/app'; + +describe('app', () => { + it('responds with a not found message', (done) => { + request(app) + .get('/what-is-this-even') + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(404, done); + }); +}); + +describe('GET /', () => { + it('responds with a json message', (done) => { + request(app) + .get('/') + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(200, { + message: '🦄🌈✨👋🌎🌍🌏✨🌈🦄', + }, done); + }); +}); -- cgit v1.3