Skip to content

Commit

Permalink
updated tests :)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZinxValkyria committed May 31, 2024
1 parent d3588cc commit 58adfc6
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions __tests__/test.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@ const request = require('supertest');
const app = require('../app');

describe('GET /', () => {
test('It should respond with status 200 and render index page', async () => {
const response = await request(app).get('/');
expect(response.status).toBe(200);
expect(response.text).toContain('index');
});
});

test('It should respond with status 200 and render index page', async () => {
const response = await request(app).get('/');
expect(response.status).toBe(200);
expect(response.text).toContain('Welcome to the MediaVerse Engine!');
});
},
describe('GET /movies', () => {
test('It should respond with status 200 and render movies page', async () => {
const response = await request(app).get('/movies');
expect(response.status).toBe(200);
expect(response.text).toContain('movies');
});
});
}),

// Add more tests for other routes...

describe('GET /api/character', () => {
test('It should respond with character data', async () => {
const response = await request(app).get('/api/character?character=Spider-Man');
expect(response.status).toBe(200);
expect(response.body).toHaveProperty('id');
expect(response.body).toHaveProperty('name', 'Spider-Man');
// Add more assertions as needed...
});
test('It should respond with character data', async () => {
const response = await request(app).get('/api/character?character=Iron%20Man'); // Use correct character name
expect(response.status).toBe(200);
expect(response.body).toHaveProperty('id');
expect(response.body).toHaveProperty('name', 'Iron Man');
// Add more assertions as needed...
});


test('It should handle errors gracefully', async () => {
// Mock the axios get method to simulate an error
Expand All @@ -36,7 +36,7 @@ describe('GET /api/character', () => {
expect(response.status).toBe(500);
expect(response.body).toHaveProperty('error', 'Internal Server Error');
});
});
}))

// Add more tests for other API endpoints...

0 comments on commit 58adfc6

Please sign in to comment.