Skip to content

Backend service tests use the real Upstash cache #369

Description

@jenul-ferdinand

What

Why

  • cloudinary.ts calls dotenv.config() when it loads. The services setup imports every model, user.model.ts imports cloudinary.ts, and so local test runs load backend/.env.
  • With the Upstash values from .env, cache.ts builds a real client. unit.service.test.ts calls fetchMostReviewed, which reads the units:popular key and, on a miss, writes the test database's units to it for a week.
  • If .env holds the production credentials, a local test run can put test data in the live site's popular units list. CI has no .env, so it never hits this.

Area

backend

Notes or constraints

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

backendbugSomething isn't workingpriority: mediumNormal priority. Pick up after high-priority items are clear.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions