Skip to content

Repository files navigation

Course Selling App – Test Suite

This repository contains integration test cases for a Course Selling backend application, written using Bun’s test runner.

The focus of this project is testing, not backend implementation.


Test Coverage

Authentication

  • Signup
  • Login
  • JWT validation
  • Protected routes (/me)

Authorization (Role-based)

  • Students cannot create courses or lessons
  • Instructors cannot purchase courses
  • Ownership enforcement for updates & deletes

Courses

  • Create course (Instructor only)
  • Get all courses (Public)
  • Get course by ID
  • Update & delete course (Owner only)

Lessons

  • Add lessons (Course instructor only)
  • Get lessons for a course (Public)

Purchases

  • Student purchases a course
  • Duplicate purchase prevention
  • User can view only their own purchases

Negative & Edge Cases

  • Forbidden access (403)
  • Unauthorized access (401)
  • Ownership violations

Setup

Install dependencies:

bun install

Update backend URL if required:

const BASE_URL = "http://localhost:3000";

⚠️ Backend implementation must be running locally before executing tests.


Running Tests

Run all test suites:

bun test

Run a specific test file:

bun test courses.test.ts

Demo Video

This video demonstrates the test cases being executed for the Course Selling application:

Kapture.2026-01-27.at.20.35.03.mp4

Notes

  • Tests are integration tests (real API, real auth, real database)
  • No mocking is used
  • Tests are self-contained and safe to re-run

Requirements Validated

✅ JWT-based authentication ✅ Role-based authorization (Student vs Instructor) ✅ Ownership checks for courses & lessons ✅ Purchase flow integrity ✅ Correct HTTP status codes


This project was created using bun init with Bun v1.2.x. Bun is a fast all-in-one JavaScript runtime.

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages