UVicMartletplace / martletplace

Recreating FB Marketplace for Students - UVic SENG499 Capstone Project
1 stars 0 forks source link

Brent/backend65 listing endpoints #144

Closed bmachado18 closed 1 week ago

bmachado18 commented 3 weeks ago

Description

Implemented each API's testing and functionality for listing microservice. This firstly involved configuring Cypress to the correct directory structure, then repeatedly writing tests equivalence class tests for an unimplemented API route, and after implementing the route until the tests pass. These endpoints defined within the swagger UI under listings, and within the API list in the SRS doc.

An additional module installed was pg-promise with the command npm install pg-promise

Keeping as a draft PR until all routes have implementations and tests.

Concerns:

Closes #65

How to Test

There might be a better way to do this, but:

  1. Remove all docker images, and build the following images:
    
    docker-compose down

docker-compose up --build -d listing database datalayer


3. Go into exec of the listing service within docker, and the test suite:

![image](https://github.com/UVicMartletplace/martletplace/assets/65056763/6d893ef5-2537-44d5-8a55-faa43d365a0f)

```npm test```

## Checklist
- [ ] The code includes tests if relevant
- [ ] I have *actually* self-reviewed my changes and done QA
<!-- Only check this off if you have actually done a self-review! DO NOT request any review from others until you have done your self-review! -->
bmachado18 commented 3 weeks ago

@UVicMartletplace/backend I added a new route for the GET /api/listings/{id} but since I am new to node and express I was hoping you could review this first route so I can reduce changes for the other routes if done incorrectly or if the file structure or directory is off.

I still need to parse the data to the response specified in the API Agreement (and its tests accordingly) but otherwise please leave a comment and let me make the changes!

ALSO take a look at the concerns section of this draft PR and maybe we can chat about them.

THANKS!

bmachado18 commented 1 week ago

Implemented each route as specified in the API spec. Other notes:

bmachado18 commented 1 week ago

@MNThomson I understand you guys are getting graded on our tests - I dumped alot of time already trying to configure unit testing with mocha and chai alongside integration tests for cypress. We don't have any true unit tests so I can dump some more time to try and figure this out if you'd like.