forked from MultiverseLearningProducts/express-get-musicians
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.test.js
33 lines (23 loc) · 928 Bytes
/
index.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// install dependencies
const { execSync } = require('child_process');
execSync('npm install');
execSync('npm run seed');
const request = require("supertest")
const { db } = require('./db/connection');
const { Musician } = require('./models/index')
const app = require('./src/app');
const seedMusician = require("./seedData");
describe('./musicians endpoint', () => {
// Write your tests here
test("Testing musicians endpoint", async () => {
// Sends request to `/bakedGoods` endpoint
const response = await request(app).get("/musicians");
expect(response.statusCode).toBe(200);
})
test("Testing musician name", async () => {
// Sends request to `/bakedGoods` endpoint
const response = await request(app).get("/musicians");
const responseData = await JSON.parse(response.text);
expect(responseData[2].name).toBe("Jimi Hendrix");
})
})