-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathada_handle_test.dart
More file actions
45 lines (38 loc) · 1.31 KB
/
ada_handle_test.dart
File metadata and controls
45 lines (38 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import 'package:ada_handle/ada_handle.dart';
import 'package:flutter_test/flutter_test.dart';
Map<String, String> stringHexPair = {
"walmart": "77616c6d617274",
"ok": "6f6b",
"ghostchain": "67686f7374636861696e",
" ghostchain ": "67686f7374636861696e",
};
Map<String, String> stringPolicyHexPair = {
"walmart": AdaHandle.prependPolicyId("77616c6d617274"),
"ok": AdaHandle.prependPolicyId("6f6b"),
"ghostchain": AdaHandle.prependPolicyId("67686f7374636861696e"),
};
Map<String, String> stringPolicyCip68HexPair = {
"noodz": AdaHandle.prependPolicyId("000de1406e6f6f647a"),
"ok": AdaHandle.prependPolicyId("000de1406f6b"),
"ghostchain": AdaHandle.prependPolicyId("000de14067686f7374636861696e"),
};
void main() {
test("stringToHex", () {
stringHexPair.forEach((handle, bytes) {
expect(AdaHandle.stringToHex(handle.trim()), bytes);
});
});
test("stringToHexExpectException", () {
expect(() => AdaHandle.stringToHex(""), throwsA(isA<Exception>()));
});
test("handleToAssetId", () {
stringPolicyHexPair.forEach((handle, bytes) {
expect(AdaHandle.getPolicyAssetHexCombination(handle), bytes);
});
});
test("handleCip68", () {
stringPolicyCip68HexPair.forEach((handle, bytes) {
expect(AdaHandle.getPolicyCip68PrefixAssetHexCombination(handle), bytes);
});
});
}