-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add interoperabilty tests for Unsubscribed message
- Loading branch information
1 parent
bfd9fca
commit 621cc02
Showing
4 changed files
with
56 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,4 +51,4 @@ void main() { | |
expect(isEqual(message, msg), true); | ||
}); | ||
}); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,4 +48,4 @@ void main() { | |
expect(isEqual(message, msg), true); | ||
}); | ||
}); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import "package:pinenacl/encoding.dart"; | ||
import "package:test/test.dart"; | ||
|
||
import "package:wampproto/messages.dart"; | ||
import "package:wampproto/serializers.dart"; | ||
|
||
import "../helper.dart"; | ||
|
||
void main() { | ||
group("Unsubscribed", () { | ||
const baseSubCommand = "message unsubscribed 1"; | ||
|
||
bool isEqual(UnSubscribed msg1, UnSubscribed msg2) => msg1.requestID == msg2.requestID; | ||
|
||
test("JSONSerializer", () async { | ||
var msg = UnSubscribed(1); | ||
var command = "$baseSubCommand --serializer json"; | ||
|
||
var output = await runCommand(command); | ||
|
||
var jsonSerializer = JSONSerializer(); | ||
var message = jsonSerializer.deserialize(output) as UnSubscribed; | ||
expect(isEqual(message, msg), true); | ||
}); | ||
|
||
test("CBORSerializer", () async { | ||
var msg = UnSubscribed(1); | ||
var command = "$baseSubCommand --serializer cbor --output hex"; | ||
|
||
var output = await runCommand(command); | ||
var outputBytes = Base16Encoder.instance.decode(output.trim()); | ||
|
||
var cborSerializer = CBORSerializer(); | ||
var message = cborSerializer.deserialize(outputBytes) as UnSubscribed; | ||
expect(isEqual(message, msg), true); | ||
}); | ||
|
||
test("MsgPackSerializer", () async { | ||
var msg = UnSubscribed(1); | ||
var command = "$baseSubCommand --serializer msgpack --output hex"; | ||
|
||
var output = await runCommand(command); | ||
var outputBytes = Base16Encoder.instance.decode(output.trim()); | ||
|
||
var msgPackSerializer = MsgPackSerializer(); | ||
var message = msgPackSerializer.deserialize(outputBytes) as UnSubscribed; | ||
expect(isEqual(message, msg), true); | ||
}); | ||
}); | ||
} |