parent
6a728ae17b
commit
aa4478b937
8 changed files with 247 additions and 238 deletions
@ -0,0 +1,59 @@ |
|||||||
|
import { expect } from "chai"; |
||||||
|
|
||||||
|
export async function createSong( |
||||||
|
req, |
||||||
|
props = { title: "Song" }, |
||||||
|
expectStatus = undefined, |
||||||
|
expectResponse = undefined |
||||||
|
) { |
||||||
|
await req |
||||||
|
.post('/song') |
||||||
|
.send(props) |
||||||
|
.then((res) => { |
||||||
|
expectStatus && expect(res).to.have.status(expectStatus); |
||||||
|
expectResponse && expect(res.body).to.deep.equal(expectResponse); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
export async function createArtist( |
||||||
|
req, |
||||||
|
props = { name: "Artist" }, |
||||||
|
expectStatus = undefined, |
||||||
|
expectResponse = undefined |
||||||
|
) { |
||||||
|
await req |
||||||
|
.post('/artist') |
||||||
|
.send(props) |
||||||
|
.then((res) => { |
||||||
|
expectStatus && expect(res).to.have.status(expectStatus); |
||||||
|
expectResponse && expect(res.body).to.deep.equal(expectResponse); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
export async function modifyArtist( |
||||||
|
req, |
||||||
|
id = 1, |
||||||
|
props = { name: "NewArtist" }, |
||||||
|
expectStatus = undefined, |
||||||
|
) { |
||||||
|
await req |
||||||
|
.put('/artist/' + id) |
||||||
|
.send(props) |
||||||
|
.then((res) => { |
||||||
|
expectStatus && expect(res).to.have.status(expectStatus); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
export async function checkArtist( |
||||||
|
req, |
||||||
|
id, |
||||||
|
expectStatus = undefined, |
||||||
|
expectResponse = undefined, |
||||||
|
) { |
||||||
|
await req |
||||||
|
.get('/artist/' + id) |
||||||
|
.then((res) => { |
||||||
|
expectStatus && expect(res).to.have.status(expectStatus); |
||||||
|
expectResponse && expect(res.body).to.deep.equal(expectResponse); |
||||||
|
}) |
||||||
|
} |
Loading…
Reference in new issue