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

fix: ensure stable sort #1130

Merged
merged 1 commit into from
Oct 5, 2023
Merged

fix: ensure stable sort #1130

merged 1 commit into from
Oct 5, 2023

Conversation

oliverlaz
Copy link
Member

Overview

Ensure Stable Sorting by mutating the source participant array.

@@ -69,7 +69,7 @@ describe('CallState', () => {

const ps2 = state.participants;
// should resolve in initial - non-mutated state as set at the beginning
expect(ps2.map((p) => p.name)).toEqual(['A', 'B', 'C', 'D', 'E', 'F']);
expect(ps2.map((p) => p.name)).toEqual(['F', 'B', 'E', 'A', 'C', 'D']);
Copy link
Contributor

@arnautov-anton arnautov-anton Oct 5, 2023

Choose a reason for hiding this comment

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

Suggested change
expect(ps2.map((p) => p.name)).toEqual(['F', 'B', 'E', 'A', 'C', 'D']);
expect(ps2.map((p) => p.name)).toMatchInlineSnapshot(...);

Can we do .toMatchInlineSnapshot instead (like here)? The outputs that vitest gives when it compares arrays is super unreadable and updating it manually is super annoying (not that we should do that often but still).

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd rather do that at some other time. There are plenty of places we would need to align.

@oliverlaz oliverlaz merged commit f96e1af into main Oct 5, 2023
16 of 17 checks passed
@oliverlaz oliverlaz deleted the stable-sort branch October 5, 2023 13:17
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.

2 participants