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

Unit tests for filters #940

Merged
merged 18 commits into from
Nov 15, 2023
Merged

Conversation

cosmicpotato137
Copy link
Contributor

@cosmicpotato137 cosmicpotato137 commented Nov 13, 2023

Describe your changes

Implemented the following unit tests:

  • Unit test for activeList function and the functions in filterValidation.ts
  • Unit test for bountyHeaderLanguageFilter function
  • Unit test for bountyHeaderFilter function

Issue ticket number and link

closes: #901

Type of change

New feature (non-breaking change which adds functionality)

Checklist before requesting a review

  • Run unit test with wrong data intentionally to see if it fails
  • Run unit tests with right data to see if it passes

@cosmicpotato137
Copy link
Contributor Author

I have noticed that prettier only fails on .ts files ... any advice?

Copy link
Contributor

@kevkevinpal kevkevinpal left a comment

Choose a reason for hiding this comment

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

looking good dont worry about the prettier issues I can figure that out for you

Copy link
Contributor

Choose a reason for hiding this comment

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

if you can remove the new yarn.lock from the diff, you can do this by typing

git checkout -- frontend/app/yarn.lock
git add frontend/app/yarn.lock
git commit -m "fix: yarn.lock"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I ran these commands, not sure it fixed the issue though

Copy link
Contributor

Choose a reason for hiding this comment

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

oops sorry meant git checkout origin/master -- frontend/app/yarn.lock

Comment on lines 27 to 32
describe('bountyHeaderLanguageFilter', () => {
test('match', () => {
expect(bountyHeaderLanguageFilter(['Javascript', 'Python'], { Javascript: true })).toEqual(
true
);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like this should be false

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why is that? Do struct values not compare with strings? This could be highlighting a problem I've been facing where none of the language filters work for me.

Comment on lines 8 to 10
test('a/t/t', () => {
expect(bountyHeaderFilter({ Assigned: true }, true, true)).toEqual(true);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like this should be false

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure because even if it's been paid, it's still assigned.

@kevkevinpal
Copy link
Contributor

not sure why the craco tests are failing too but don't worry about those either I can deal with them just focus on getting the jest tests to work, let me know if you come across any new blockers

@cosmicpotato137
Copy link
Contributor Author

not sure why the craco tests are failing too but don't worry about those either I can deal with them just focus on getting the jest tests to work, let me know if you come across any new blockers

It looked like craco was running the same tests as jest

@cosmicpotato137
Copy link
Contributor Author

@kevkevinpal any idea why this test is failing?

testing helpers › bountyHeaderLanguageFilter › match

@kevkevinpal kevkevinpal merged commit 01b20d3 into stakwork:master Nov 15, 2023
5 checks passed
@cosmicpotato137 cosmicpotato137 deleted the unit-tests branch November 15, 2023 17:26
elraphty pushed a commit that referenced this pull request Jan 26, 2024
* update user roles update window

* final tweaks

* syncing with origin

* added filterValidation tests

* finished tests for bountyHeaderLanguageFilter, bountyHeaderFilter functions

* prettier

* bug fix

* fixed a/t/t test

* test: fixed test to pass

* fix: no new yarn.lock

---------

Co-authored-by: kevkevin <oapallikunnel@gmail.com>
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.

[Bounty Homepage-Signed Out] Unit tests for filters
2 participants