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

[#12588] Improve test code coverage of core components #13050

Conversation

WayyGood
Copy link

PR title: [#12588] Improve test code coverage of core components

(PerQuestionViewResponsesComponent)

Outline of Solution
added testing for some uncovered functions

Copy link

Hi @WayyGood, thank you for your interest in contributing to TEAMMATES!
However, your PR does not appear to follow our contribution guidelines:

  • Title must start with the issue number the PR is fixing in square brackets, e.g. [#<issue-number>]
  • Description must reference the issue number the PR is fixing, e.g. Fixes #<issue-number> (or Part of #<issue-number> if the PR does not address the issue fully)

Please address the above before we proceed to review your PR.

@ziqing26 ziqing26 changed the title coverage additions [#12588] Improve test code coverage of core components Apr 18, 2024
@ziqing26
Copy link
Contributor

Hi @WayyGood, thanks for the PR. Please fix the failed Github actions.

Copy link
Contributor

@Andy-W-Developer Andy-W-Developer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SortBy and SortOrder are not imported

add
import { SortBy, SortOrder } from '../../../../types/sort-properties';
to the top of the file

it('should open modal and set currResponseToAdd when showCommentTableModel is called', () => {
const selectedResponse: ResponseOutput = { /* mock response */ };
const modalResultPromise = new Promise(resolve => resolve());
const commentModalRef: NgbModalRef = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an import for NgbModelRef

import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';

const responseWithoutMissing: ResponseOutput = { isMissingResponse: false };
component.responses = [responseWithMissing, responseWithoutMissing];

component.filterResponses();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private methods cannot be called from your test

you can call filterResponses() indirectly with ngOnInit() or ngOnChanges() because they both run this.filterResponses()

@weiquu
Copy link
Contributor

weiquu commented Jun 29, 2024

Closing due to inactivity

@weiquu weiquu closed this Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants