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

Add unit tests #5412

Merged
merged 7 commits into from
Oct 15, 2024
Merged

Add unit tests #5412

merged 7 commits into from
Oct 15, 2024

Conversation

Airthee
Copy link
Contributor

@Airthee Airthee commented Apr 23, 2024

Changes
Add unit tests to some utils files.

Issues

Fixes #4872

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

ESLint doesn't pass. Please fix all ESLint issues.

src/utils/card.test.ts Outdated Show resolved Hide resolved
src/utils/card.test.ts Outdated Show resolved Hide resolved
src/utils/card.test.ts Outdated Show resolved Hide resolved
src/utils/card.test.ts Outdated Show resolved Hide resolved
src/utils/card.test.ts Outdated Show resolved Hide resolved
src/utils/dateFnsLocale.test.ts Outdated Show resolved Hide resolved
src/utils/dateFnsLocale.test.ts Outdated Show resolved Hide resolved
src/utils/dateFnsLocale.test.ts Outdated Show resolved Hide resolved
src/utils/dateFnsLocale.test.ts Outdated Show resolved Hide resolved
src/utils/dateFnsLocale.test.ts Outdated Show resolved Hide resolved
@jellyfin-bot
Copy link
Collaborator

jellyfin-bot commented Apr 23, 2024

Cloudflare Pages deployment

Latest commit c7d36af
Status ✅ Deployed!
Preview URL https://91cc3b0d.jellyfin-web.pages.dev
Type 🔀 Preview

View build logs

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

ESLint doesn't pass. Please fix all ESLint issues.

src/utils/events.test.ts Outdated Show resolved Hide resolved
src/utils/events.test.ts Outdated Show resolved Hide resolved
src/utils/events.test.ts Outdated Show resolved Hide resolved
src/utils/events.test.ts Outdated Show resolved Hide resolved
src/utils/events.test.ts Outdated Show resolved Hide resolved
src/utils/events.test.ts Outdated Show resolved Hide resolved

eventsUtils.trigger(obj, 'testEvent', ['testValue1', 'testValue2']);

expect(callback).toHaveBeenCalledWith({type: 'testEvent'}, 'testValue1', 'testValue2');
Copy link
Contributor

Choose a reason for hiding this comment

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

A space is required after '{'. object-curly-spacing

Fix available:

Suggested change
expect(callback).toHaveBeenCalledWith({type: 'testEvent'}, 'testValue1', 'testValue2');
expect(callback).toHaveBeenCalledWith({ type: 'testEvent'}, 'testValue1', 'testValue2');


eventsUtils.trigger(obj, 'testEvent', ['testValue1', 'testValue2']);

expect(callback).toHaveBeenCalledWith({type: 'testEvent'}, 'testValue1', 'testValue2');
Copy link
Contributor

Choose a reason for hiding this comment

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

A space is required before '}'. object-curly-spacing

Fix available:

Suggested change
expect(callback).toHaveBeenCalledWith({type: 'testEvent'}, 'testValue1', 'testValue2');
expect(callback).toHaveBeenCalledWith({type: 'testEvent' }, 'testValue1', 'testValue2');


expect(callback).toHaveBeenCalledWith({type: 'testEvent'}, 'testValue1', 'testValue2');
});
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing semicolon. @typescript-eslint/semi

Fix available:

Suggested change
})
});

expect(callback).toHaveBeenCalledWith({type: 'testEvent'}, 'testValue1', 'testValue2');
});
})
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing semicolon. @typescript-eslint/semi

Fix available:

Suggested change
})
});

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

ESLint doesn't pass. Please fix all ESLint issues.


expect(obj).toHaveProperty('_callbacks', { testEvent: [initialCallback] });
});
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing semicolon. @typescript-eslint/semi

Fix available:

Suggested change
})
});


eventsUtils.trigger(obj, 'testEvent', ['testValue1', 'testValue2']);

expect(callback).toHaveBeenCalledWith({type: 'testEvent'}, 'testValue1', 'testValue2');
Copy link
Contributor

Choose a reason for hiding this comment

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

A space is required after '{'. object-curly-spacing

Fix available:

Suggested change
expect(callback).toHaveBeenCalledWith({type: 'testEvent'}, 'testValue1', 'testValue2');
expect(callback).toHaveBeenCalledWith({ type: 'testEvent'}, 'testValue1', 'testValue2');


eventsUtils.trigger(obj, 'testEvent', ['testValue1', 'testValue2']);

expect(callback).toHaveBeenCalledWith({type: 'testEvent'}, 'testValue1', 'testValue2');
Copy link
Contributor

Choose a reason for hiding this comment

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

A space is required before '}'. object-curly-spacing

Fix available:

Suggested change
expect(callback).toHaveBeenCalledWith({type: 'testEvent'}, 'testValue1', 'testValue2');
expect(callback).toHaveBeenCalledWith({type: 'testEvent' }, 'testValue1', 'testValue2');

@thornbill
Copy link
Member

@Airthee I'm trying to clean up some stale PRs... do you plan to continue working on this?

@Airthee
Copy link
Contributor Author

Airthee commented Oct 15, 2024

Hi ! Sorry I didn't work on it since many months, but I will try to fix lint and remove draft when all is green.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

ESLint doesn't pass. Please fix all ESLint issues.


expect(obj).toHaveProperty('_callbacks', { testEvent: [initialCallback] });
});
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing semicolon. @stylistic/semi

Fix available:

Suggested change
})
});


eventsUtils.trigger(obj, 'testEvent', ['testValue1', 'testValue2']);

expect(callback).toHaveBeenCalledWith({type: 'testEvent'}, 'testValue1', 'testValue2');
Copy link
Contributor

Choose a reason for hiding this comment

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

A space is required after '{'. @stylistic/object-curly-spacing

Fix available:

Suggested change
expect(callback).toHaveBeenCalledWith({type: 'testEvent'}, 'testValue1', 'testValue2');
expect(callback).toHaveBeenCalledWith({ type: 'testEvent'}, 'testValue1', 'testValue2');


eventsUtils.trigger(obj, 'testEvent', ['testValue1', 'testValue2']);

expect(callback).toHaveBeenCalledWith({type: 'testEvent'}, 'testValue1', 'testValue2');
Copy link
Contributor

Choose a reason for hiding this comment

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

A space is required before '}'. @stylistic/object-curly-spacing

Fix available:

Suggested change
expect(callback).toHaveBeenCalledWith({type: 'testEvent'}, 'testValue1', 'testValue2');
expect(callback).toHaveBeenCalledWith({type: 'testEvent' }, 'testValue1', 'testValue2');

Copy link

@Airthee Airthee marked this pull request as ready for review October 15, 2024 19:09
@Airthee Airthee requested a review from a team as a code owner October 15, 2024 19:09
@Airthee Airthee changed the title draft: Add unit tests Add unit tests Oct 15, 2024
@Airthee
Copy link
Contributor Author

Airthee commented Oct 15, 2024

@thornbill I think it's all good !
If a want to add some new tests, can I refer to the same issue event if it is closed ?

@thornbill
Copy link
Member

Yes, you can continue to reference the closed issue or just leave it blank. Either way is fine.

@thornbill thornbill added the tests This PR or issue mainly concerns tests label Oct 15, 2024
@thornbill thornbill added this to the v10.10.0 milestone Oct 15, 2024
@thornbill thornbill merged commit a133a33 into jellyfin:master Oct 15, 2024
14 checks passed
@Airthee Airthee deleted the add_unit_tests branch October 15, 2024 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests This PR or issue mainly concerns tests
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add tests to the project
3 participants