Skip to content

Conversation

@Coteh
Copy link

@Coteh Coteh commented Feb 11, 2024

Fixes #51

Finally got around to this. This is what I'm thinking of for the new toReceiveMessage matcher, as we discussed before.

Here are some example failure messages:

Wrong message received

expect(WS).toReceiveMessage(expected)

Expected the following message within 1000ms:
  "PRIVMSG #mychannel :Not the message"
but instead received the following messages:
  ["PASS mypass", "NICK coteh", "USER coteh 0 * :James", "PRIVMSG #mychannel :Hello there"]

Difference:

- Expected
+ Received

  Array [
-   "PRIVMSG #mychannel :Not the message",
+   "PASS mypass",
+   "NICK coteh",
+   "USER coteh 0 * :James",
+   "PRIVMSG #mychannel :Hello there",
  ]

Message never received

expect(WS).toReceiveMessage(expected)

Expected the following message within 1000ms:
  "PRIVMSG #mychannel :Hello there"
but instead received the following messages:
  ["PASS mypass", "NICK coteh", "USER coteh 0 * :James"]

Difference:

- Expected
+ Received

  Array [
-   "PRIVMSG #mychannel :Hello there",
+   "PASS mypass",
+   "NICK coteh",
+   "USER coteh 0 * :James",
  ]

Nothing was received at all

expect(WS).toReceiveMessage(expected)

Expected the following message within 1000ms:
  "PRIVMSG #mychannel :Hello there"
but it didn't receive anything.

Let me know your thoughts. If you think it looks good and can still benefit the project, I'll take this out of draft, polish it up a bit, and apply any feedback you may have. Thanks!

…ead of next message

Rename old "toReceiveMessage" matcher to "toReceiveMessageNext"
@Coteh Coteh marked this pull request as draft February 11, 2024 21:38
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.

Add ability to flush pending message queue

1 participant