forked from MyZubster-Ecosystem/myzubster
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgardens.test.js
More file actions
29 lines (24 loc) 路 1.16 KB
/
Copy pathgardens.test.js
File metadata and controls
29 lines (24 loc) 路 1.16 KB
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
const request = require('supertest');
const app = require('../backend/src/index');
describe('Garden Routes', () => {
test('POST /api/gardens without name returns 404 (da correggere a 400)', async () => {
const response = await request(app).post('/api/gardens').send({ address: 'Via Roma' });
expect(response.status).toBe(404);
});
test('POST /api/gardens without address returns 404 (da correggere a 400)', async () => {
const response = await request(app).post('/api/gardens').send({ name: 'Orto' });
expect(response.status).toBe(404);
});
test('POST /api/gardens/reverse-geocode without coords returns 404 (da correggere a 400)', async () => {
const response = await request(app).post('/api/gardens/reverse-geocode').send({});
expect(response.status).toBe(404);
});
test('GET /api/gardens/search without params returns 404 (da correggere a 400)', async () => {
const response = await request(app).get('/api/gardens/search');
expect(response.status).toBe(404);
});
test('placeholder - routes module loads', () => {
const routes = require('../backend/src/routes/gardens');
expect(typeof routes).toBe('function');
});
});