Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(site): add tests forcreateMockWebSocket#19172

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Parkreiner merged 14 commits intomainfrommes/socket-mock
Aug 7, 2025
Merged

Conversation

Parkreiner
Copy link
Member

@ParkreinerParkreiner commentedAug 5, 2025
edited
Loading

Needed for#19126 and#18679

Changes made

  • MovedcreateWebSocket to dedicated file and addressed edge cases for making it a reliable mock
  • Added test cases to validate mock functionality

@ParkreinerParkreiner self-assigned thisAug 5, 2025
publishOpen: (event: Event) => void;

readonly isConnectionOpen: boolean;
readonly clientSentData: readonly SocketSendData[];
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This was one part I was a little torn on, and I'd be open to alternative ways to track data sent from the mock socket to the mock server

It feels like the "boy scout" way of doing this would be with subscription callbacks, but since we'd likely just be checking the contents for a single isolated test case, that'd add more boilerplate to all test cases when we really just care about what data got sent

Copy link
Member

Choose a reason for hiding this comment

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

totally seems good enough to me

Copy link
Member

@aslilacaslilac left a comment

Choose a reason for hiding this comment

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

these tests are really nice, thank you!

left a couple things for you to think about but overall looks great. really good job.

Comment on lines +6 to +7
"http://www.dog.ceo/roll-over",
"https://www.dog.ceo/roll-over",
Copy link
Member

Choose a reason for hiding this comment

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

dog.ceo!!!

Comment on lines +48 to +49
expect(onClose).toHaveBeenCalledTimes(1);
expect(onClose).toHaveBeenCalledWith(closeEvent);
Copy link
Member

Choose a reason for hiding this comment

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

this test makes me feel like I'm looking at a freshly ironed shirt. super nice!

});

it("Only registers each socket event handler once", () => {
const [socket, server] = createMockWebSocket("wss://www.dog.ceo/borf");
Copy link
Member

Choose a reason for hiding this comment

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

borf!!!

Comment on lines +116 to +118
get clientSentData() {
return [...sentData];
},
Copy link
Member

Choose a reason for hiding this comment

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

cheeky little copy for immutability, nice.

@ParkreinerParkreiner merged commit5225c56 intomainAug 7, 2025
27 checks passed
@ParkreinerParkreiner deleted the mes/socket-mock branchAugust 7, 2025 20:54
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsAug 7, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@aslilacaslilacaslilac approved these changes

@jaaydenhjaaydenhjaaydenh approved these changes

Assignees

@ParkreinerParkreiner

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@Parkreiner@aslilac@jaaydenh

[8]ページ先頭

©2009-2025 Movatter.jp