This repository contains a TypeScript project designed to test the functionality of a factorial calculator. The project is structured into three main components: an API endpoint class which targets the factorial calculator of a https://qainterview.pythonanywhere.com/ , a factorial calculation function, and a suite of tests using Playwright.
The project aims to ensure that the factorial calculator operates correctly across a range of inputs, specifically integers between 10 and 100. It includes a TypeScript class for interacting with the API, a function to calculate factorial values, and automated tests to validate the calculator's responses against expected outcomes.
ApiEndpoint.ts
: Defines theApiEndpoint
class for making POST requests to the/factorial
endpoint. It validates input and sends a factorial calculation request.factorialCalculator.ts
: Contains thecalculateFactorial
function that computes the factorial of a number, supporting large integers by returning results in scientific notation if necessary.factorialTests.spec.ts
: Playwright test suite that includes tests for specific, random, and all integers in the range 10-100, ensuring the API and calculator function correctly.
- Node.js
- TypeScript
- Playwright
Ensure you have the above prerequisites installed on your system to run the tests and interact with the API.
- Clone the repository:
- npm install
- npm run test:api