Updated tests
Some checks failed
continuous-integration/drone/pr Build is failing

ref #193
This commit is contained in:
2021-04-14 18:34:15 +02:00
parent 0636616dad
commit 01ed51489e
2 changed files with 63 additions and 2 deletions

View File

@@ -170,7 +170,7 @@ describe('POST /api/donations/fixed successfully', () => {
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json")
});
it('creating a new fixed donation should return 200', async () => {
it('creating a new fixed donation with more params should return 200', async () => {
const res = await axios.post(base + '/api/donations/fixed', {
"donor": added_donor.id,
"amount": 1000
@@ -181,6 +181,23 @@ describe('POST /api/donations/fixed successfully', () => {
expect(res.data).toEqual({
"donor": added_donor,
"amount": 1000,
"payedAmount": 0,
"responseType": "DONATION"
});
});
it('creating a new fixed donation with all params should return 200', async () => {
const res = await axios.post(base + '/api/donations/fixed', {
"donor": added_donor.id,
"amount": 1000,
"payedAmount": 1000
}, axios_config);
delete res.data.id;
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json");
expect(res.data).toEqual({
"donor": added_donor,
"amount": 1000,
"payedAmount": 1000,
"responseType": "DONATION"
});
});
@@ -219,7 +236,7 @@ describe('POST /api/donations/distance successfully', () => {
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json")
});
it('creating a new fixed donation should return 200', async () => {
it('creating a new fixed donation with most params should return 200', async () => {
const res = await axios.post(base + '/api/donations/distance', {
"runner": added_runner.id,
"amountPerDistance": 100,
@@ -233,6 +250,26 @@ describe('POST /api/donations/distance successfully', () => {
"amountPerDistance": 100,
"runner": added_runner,
"amount": 0,
"payedAmount": 0,
"responseType": "DISTANCEDONATION"
})
});
it('creating a new fixed donation with all params should return 200', async () => {
const res = await axios.post(base + '/api/donations/distance', {
"runner": added_runner.id,
"amountPerDistance": 100,
"donor": added_donor.id,
"payedAmount": 1000
}, axios_config);
delete res.data.id;
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json");
expect(res.data).toEqual({
"donor": added_donor,
"amountPerDistance": 100,
"runner": added_runner,
"amount": 0,
"payedAmount": 1000,
"responseType": "DISTANCEDONATION"
})
});