-
Notifications
You must be signed in to change notification settings - Fork 12
Unit Test: 409 server error #74
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
Conversation
| var data = { title: 'hola mundo' }; | ||
|
|
||
| channel.on( 'acknowledge', function() { | ||
| channel.once( 'acknowledge', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this, any future channel.emit('acknowledge') causes a test to error because done is called more than once.
| /** | ||
| * Simulate receiving a 409 | ||
| */ | ||
| channel.handleMessage( 'c:[{"error": 409, "ccids":["dup-ccid"], "id": "mock-id"}]' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c:[{"clientid":"offending-client","id":"object-key","error":"401","ccids":["abcdef123456"]}]
|
Worth noting in the protocol docs it says:
|
|
|
||
| break; | ||
| case CODE_DUPLICATE_CHANGE: | ||
| internal.updateAcknowledged.call( this, acknowledged ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left this as a separate case since it carries a different semantic meaning than an empty change
|
Let's |
Unit test to simulate a client receiving a 409 error from the server for a change that originated from the same client.
The fix is intentionally left out which should be as simple as: