-
Notifications
You must be signed in to change notification settings - Fork 0
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
Expand test coverage for required status scenarios #9
Conversation
Adds unit tests for handling workflow run statuses and updates Jest configuration for testing. - **Unit Tests**: Implements tests in `__tests__/required.test.ts` to simulate different scenarios including all required statuses completing successfully, only one required status reporting success, one required status reporting failure, and a replication lag scenario. Each test checks if the correct commit status is created with the expected state and description. - **Environment Variable**: Sets the `GITHUB_REPOSITORY` environment variable in the test setup to mimic the GitHub Actions environment. - **Error Handling**: Adds error handling in the mocked `listWorkflowRunsForRepo` method to simulate a scenario where `data` is undefined, preventing `TypeError`. - **Jest Configuration**: Modifies the `ci-test` and `test` scripts in `package.json` to use Jest for running tests and generating coverage reports. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/urcomputeringpal/optional-required-workflows/pull/9?shareId=dcb656a4-22f3-448f-a591-6dd98310352a).
Adds unit tests for handling workflow run statuses and updates Jest configuration for testing.
For more details, open the Copilot Workspace session. |
Implements additional test cases and updates existing ones in
For more details, open the Copilot Workspace session. |
Implements additional test cases and updates existing ones in `__tests__/required.test.ts` to enhance testing of the `required` function with a focus on mocking `getWorkflowRun`. - Adds a mock implementation for `getWorkflowRun` to return a specific workflow run object, simulating a successful workflow run scenario. - Introduces a new test case that explicitly verifies the behavior of the `required` function when `getWorkflowRun` returns a specific workflow run object. This test ensures that the function processes the mocked response correctly and sets the commit status as expected. - Updates the `beforeEach` setup to include the new mock implementation for `getWorkflowRun`, ensuring all tests have access to the mocked function. - Adjusts the `ci-test` and `test` scripts in `package.json` to run Jest tests, including coverage reporting for the `test` script. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/urcomputeringpal/optional-required-workflows/pull/9?shareId=d4edab1d-8713-4535-ab11-3f0a826b4df1).
Fix test failures related to replication lag scenario and getWorkflowRun behavior, and ensure proper handling of undefined workflow data.
For more details, open the Copilot Workspace session. |
Fix test failures related to replication lag scenario and getWorkflowRun behavior, and ensure proper handling of undefined workflow data. - Update the expectation in the "should handle replication lag scenario" test to correctly assert the pending state and description. - Modify the "verifies behavior with getWorkflowRun returning a specific workflow run object" test to simulate a successful response for `listWorkflowRunsForRepo`, ensuring the test passes by addressing the "Workflow runs data is undefined" error. - Add checks in `src/required.ts` for undefined `workflow.data` and `workflowRuns.data` to prevent errors when accessing properties of undefined data. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/urcomputeringpal/optional-required-workflows/pull/9?shareId=46bddfa4-9d6b-4092-92fb-66cf68c0a1ce).
Related to #8
Adds comprehensive tests and updates test scripts to enhance the project's testing framework.
__tests__/required.test.ts
to cover scenarios including all required statuses completing successfully, only one of the required statuses reporting success, one of the required statuses reporting failure, and handling replication lag.package.json
scripts to run Jest tests, including coverage, replacing placeholders with actual test execution commands. This ensures that the newly added tests are executed as part of the project's continuous integration process.For more details, open the Copilot Workspace session.