-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add encode and serialise tests, use btreeset for determinism
- Loading branch information
Showing
8 changed files
with
225 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#![cfg(feature = "encode")] | ||
|
||
const MANIFEST: &str = include_str!("test-manifest.json"); | ||
|
||
#[test] | ||
fn encode_works() { | ||
let manifest = serde_json::from_str(MANIFEST).unwrap(); | ||
let encoded_manifest = mrf_manifest::encode(&manifest).unwrap(); | ||
insta::assert_json_snapshot!(encoded_manifest); | ||
} |
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,11 @@ | ||
#![cfg(feature = "serialise")] | ||
|
||
const MANIFEST: &str = include_str!("test-manifest.json"); | ||
|
||
#[test] | ||
fn encode_works() { | ||
let manifest = serde_json::from_str(MANIFEST).unwrap(); | ||
let encoded_manifest = mrf_manifest::serialise(&manifest).unwrap(); | ||
let encoded_manifest_str = String::from_utf8(encoded_manifest).unwrap(); | ||
insta::assert_snapshot!(encoded_manifest_str); | ||
} |
190 changes: 190 additions & 0 deletions
190
lib/mrf-manifest/tests/snapshots/encode__encode_works.snap
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,190 @@ | ||
--- | ||
source: lib/mrf-manifest/tests/encode.rs | ||
expression: encoded_manifest | ||
--- | ||
[ | ||
0, | ||
181, | ||
1, | ||
11, | ||
109, | ||
97, | ||
110, | ||
105, | ||
102, | ||
101, | ||
115, | ||
116, | ||
45, | ||
118, | ||
48, | ||
123, | ||
34, | ||
97, | ||
99, | ||
116, | ||
105, | ||
118, | ||
105, | ||
116, | ||
121, | ||
84, | ||
121, | ||
112, | ||
101, | ||
115, | ||
34, | ||
58, | ||
91, | ||
34, | ||
65, | ||
110, | ||
110, | ||
111, | ||
117, | ||
110, | ||
99, | ||
101, | ||
34, | ||
44, | ||
34, | ||
67, | ||
114, | ||
101, | ||
97, | ||
116, | ||
101, | ||
34, | ||
44, | ||
34, | ||
68, | ||
101, | ||
108, | ||
101, | ||
116, | ||
101, | ||
34, | ||
44, | ||
34, | ||
76, | ||
105, | ||
107, | ||
101, | ||
34, | ||
93, | ||
44, | ||
34, | ||
97, | ||
112, | ||
105, | ||
86, | ||
101, | ||
114, | ||
115, | ||
105, | ||
111, | ||
110, | ||
34, | ||
58, | ||
34, | ||
118, | ||
49, | ||
34, | ||
44, | ||
34, | ||
99, | ||
111, | ||
110, | ||
102, | ||
105, | ||
103, | ||
83, | ||
99, | ||
104, | ||
101, | ||
109, | ||
97, | ||
34, | ||
58, | ||
110, | ||
117, | ||
108, | ||
108, | ||
44, | ||
34, | ||
109, | ||
97, | ||
110, | ||
105, | ||
102, | ||
101, | ||
115, | ||
116, | ||
86, | ||
101, | ||
114, | ||
115, | ||
105, | ||
111, | ||
110, | ||
34, | ||
58, | ||
34, | ||
118, | ||
49, | ||
34, | ||
44, | ||
34, | ||
110, | ||
97, | ||
109, | ||
101, | ||
34, | ||
58, | ||
34, | ||
116, | ||
101, | ||
115, | ||
116, | ||
45, | ||
109, | ||
97, | ||
110, | ||
105, | ||
102, | ||
101, | ||
115, | ||
116, | ||
34, | ||
44, | ||
34, | ||
118, | ||
101, | ||
114, | ||
115, | ||
105, | ||
111, | ||
110, | ||
34, | ||
58, | ||
34, | ||
48, | ||
46, | ||
48, | ||
46, | ||
49, | ||
45, | ||
99, | ||
97, | ||
116, | ||
116, | ||
121, | ||
119, | ||
97, | ||
109, | ||
112, | ||
117, | ||
115, | ||
34, | ||
125 | ||
] |
5 changes: 5 additions & 0 deletions
5
lib/mrf-manifest/tests/snapshots/serialise__encode_works.snap
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,5 @@ | ||
--- | ||
source: lib/mrf-manifest/tests/serialise.rs | ||
expression: encoded_manifest_str | ||
--- | ||
{"activityTypes":["Announce","Create","Delete","Like"],"apiVersion":"v1","configSchema":null,"manifestVersion":"v1","name":"test-manifest","version":"0.0.1-cattywampus"} |