Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API-Client pipeline not failing on broken unit tests #144

Open
pfwd opened this issue Oct 8, 2022 · 0 comments
Open

API-Client pipeline not failing on broken unit tests #144

pfwd opened this issue Oct 8, 2022 · 0 comments
Assignees
Labels
api client Any thing to do with the API Client api Anything to do with the API bug Something isn't working
Milestone

Comments

@pfwd
Copy link
Contributor

pfwd commented Oct 8, 2022

Describe the bug

API-Client pipeline is not failing correctly when generated openapi spec doesn't exist

This pipeline passed when it failed

yarn run v1.22.19
$ jest
FAIL tests/unit/MockData/htmlAnswers.test.ts
  ● Test suite failed to run

    src/mockData/htmlQuiz/htmlAnswers.ts:1:22 - error TS230[7](https://github.com/howToCodeWell/code-quiz/actions/runs/3211121002/jobs/5249066403#step:6:8): Cannot find module '../../generated/openapi/src' or its corresponding type declarations.

    1 import {Answer} from "../../generated/openapi/src"
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PASS tests/unit/api/apiClient.test.ts
  API Client headers
    ✓ Should have a content type of application/json (2 ms)
    ✓ Should have a accept header with the value application/json
  API Client options
    ✓ Should have the base url of http://localhost:3000

FAIL tests/integration/api/requestHandlers/quizRequest.test.ts
  ● Test suite failed to run

    src/mockData/quiz.ts:1:20 - error TS2307: Cannot find module '../generated/openapi/src' or its corresponding type declarations.

    1 import {Quiz} from "../generated/openapi/src"
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~

FAIL tests/integration/server.test.ts
  ● Test suite failed to run

    src/mockData/quiz.ts:1:[20](https://github.com/howToCodeWell/code-quiz/actions/runs/3211121002/jobs/5249066403#step:6:21) - error TS[23](https://github.com/howToCodeWell/code-quiz/actions/runs/3211121002/jobs/5249066403#step:6:24)07: Cannot find module '../generated/openapi/src' or its corresponding type declarations.

    1 import {Quiz} from "../generated/openapi/src"

Steps to reproduce

  1. Don't generate OpenAPI spec file
  2. Run the unit tests

Expected behavior

Pipeline should of failed

Screenshots and recordings

See https://github.com/howToCodeWell/code-quiz/actions/runs/3211121002/jobs/5249066403

OS / Linux distribution

MacOS

Additional context

No response

@pfwd pfwd self-assigned this Oct 8, 2022
@pfwd pfwd added bug Something isn't working api client Any thing to do with the API Client api Anything to do with the API labels Oct 8, 2022
@pfwd pfwd added this to the API setup milestone Oct 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api client Any thing to do with the API Client api Anything to do with the API bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant