Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AnveshNalimela committed Feb 4, 2024
1 parent c3bf6ae commit 90a7186
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 248 deletions.
57 changes: 57 additions & 0 deletions __tests__/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,62 @@ describe('Test LMS Application', () => {
});

});
describe('Student Features Test Suite', () => {
test('should student allow a user to sign up ', async () => {
const response = await request(app)
.post('/user')
.send({
name: 'John Doe',
email: '[email protected]',
password: 'password123',
role: 'student',
});

expect(response.statusCode).toBe(302); // Redirect after successful signup
});
test('should student allow enroll in a course', async () => {
const courseId = 'your-course-id';
const response = await request(app)
.post(`/enrollCourse/${courseId}`)

expect(response.statusCode).toBe(302); // Redirect after successful signup

});
test('should student allow mark a page as completed ', async () => {
const pageId = 1;
const response = await request(app)
.post(`/completePage/${pageId}`)

expect(response.statusCode).toBe(302);

});
test('User can signout of application ', async () => {

const response = await request(app)
.get('/signout')

expect(response.statusCode).toBe(302);

});
});

});



















5 changes: 4 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,10 @@ app.get("/signout", (request, response, next) => {
request.logout((err) => {
if (err) { return next(err); }
console.log("Sign out Successfully")
response.render('signOut.ejs');
response.redirect('/signOut-success');
});
});
app.get("/signOut-success", async (request, response) => {
await response.render("signOut.ejs")
})
module.exports = app;
Empty file removed sample copy.html
Empty file.
123 changes: 0 additions & 123 deletions sample.html

This file was deleted.

123 changes: 0 additions & 123 deletions sample.txt

This file was deleted.

2 changes: 1 addition & 1 deletion views/course.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div class="container mx-auto flex items-center justify-center p-8">
<!-- Left Side: Course Details -->
<div class="w-full md:w-4/5 px-9">
<div class="flex items-center"><a href="/educator">
<div class="flex items-center"><a class="mr-2" href="/educator">
<div class="flex items-center justify-right">
<img src="https://cdn-icons-png.flaticon.com/512/7518/7518214.png"
class="w-35 h-11 my-3 flex items-center justify-middle" alt="view course">
Expand Down

0 comments on commit 90a7186

Please sign in to comment.