Skip to content

Samillah47/ai-software-engineer-assignment-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Software Engineer Assignment (TypeScript)

A TypeScript project demonstrating OAuth2 token management with proper testing and Docker support.


Running Tests

Prerequisites

  • Node.js 20.x or higher
  • npm
  • Docker (for containerized testing)

Run Tests Locally

1. Install dependencies

npm install

2. Run tests

npm test

Run Tests with Docker

1. Build the Docker image

docker build -t ai-assignment-test .

2. Run tests in a container

docker run ai-assignment-test

The Docker container will automatically run:

npm test

and display the test results.


Bug Fix Summary

The Bug

The HttpClient.request() method failed to refresh OAuth2 tokens when oauth2Token was a plain JavaScript object instead of an OAuth2Token instance. This resulted in missing Authorization headers in outgoing requests.

The Fix

Modified the token validation logic in src/httpClient.ts to properly handle plain object tokens by checking the instance type before attempting to access instance-specific properties.

About

AI Software Engineer Assignment - TypeScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors