Files
IKAR/third_party/kusoft/test/payload_codec_test.dart

22 lines
602 B
Dart

import 'dart:typed_data';
import 'package:flutter_test/flutter_test.dart';
import 'package:kusoft/kusoft.dart';
void main() {
test('numeric participant keys use the compatible JSON form', () {
final payload = decodeKusoftPayload(
r'{"participants":{"$int:501":10,"$int:777":20}}',
);
expect(payload['participants'], {'501': 10, '777': 20});
});
test('binary payload values are restored', () {
final payload = decodeKusoftPayload(r'{"body":{"$bin":"AQID"}}');
expect(payload['body'], isA<Uint8List>());
expect(payload['body'], orderedEquals([1, 2, 3]));
});
}