Created
September 23, 2019 21:36
-
-
Save beaucollins/019131c0623a8ea49e2e5c1c905f7aed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/test/simperium/channel_test.js b/test/simperium/channel_test.js | |
| index 0db6fae..d409aba 100644 | |
| --- a/test/simperium/channel_test.js | |
| +++ b/test/simperium/channel_test.js | |
| @@ -437,6 +437,30 @@ describe( 'Channel', function() { | |
| done() | |
| } ); | |
| } ); | |
| + | |
| + it( 'should handle a 409', ( done ) =>{ | |
| + channel.localQueue.sent['mock-id'] = { fake: 'change', ccid: 'dup-ccid' } | |
| + | |
| + /** | |
| + * If the 409 is not handled the bucket will error | |
| + */ | |
| + bucket.once( 'error', ( e ) => { | |
| + done( e ); | |
| + } ); | |
| + | |
| + /** | |
| + * After successfully handling the 409 we should have an acknowledged | |
| + * local change. | |
| + */ | |
| + channel.once( 'acknowledge', ( id, change ) => { | |
| + done(); | |
| + } ); | |
| + | |
| + /** | |
| + * Simulate receiving a 409 | |
| + */ | |
| + channel.handleMessage( 'c:[{"error": 409, "ccid":"dup-ccid", "id": "mock-id"}]' ); | |
| + } ); | |
| } ); | |
| } ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment