aboutsummaryrefslogtreecommitdiffstats
path: root/tests/schema_tests.rs
diff options
context:
space:
mode:
authoralpaylan2021-04-14 01:49:24 +0300
committeralpaylan2021-04-14 01:49:24 +0300
commit5f4f914fd12442b481f8ac1c6b6a4fd04182a6b6 (patch)
tree6be7464a6c971b24d8e539c3e7dc0ffb12b884fc /tests/schema_tests.rs
parentfe2cd485ffed31e25d30a378dd20cba11b13dfbf (diff)
downloadgradecoin-5f4f914fd12442b481f8ac1c6b6a4fd04182a6b6.tar.gz
gradecoin-5f4f914fd12442b481f8ac1c6b6a4fd04182a6b6.tar.bz2
gradecoin-5f4f914fd12442b481f8ac1c6b6a4fd04182a6b6.zip
start testing schema
Diffstat (limited to 'tests/schema_tests.rs')
-rw-r--r--tests/schema_tests.rs22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/schema_tests.rs b/tests/schema_tests.rs
index 5c28aed..8b07f72 100644
--- a/tests/schema_tests.rs
+++ b/tests/schema_tests.rs
@@ -1,9 +1,29 @@
1#[cfg(test)] 1#[cfg(test)]
2mod tests { 2mod tests {
3 use gradecoin::schema::*;
4 use serde_json::error::Error;
5 use serde_test::{assert_tokens, Token};
3 6
4 #[test] 7 #[test]
5 fn claims_serialize_correctly() { 8 fn claims_serialize_correctly() {
6 9 let claims = Claims {
10 tha: "hashed_string".to_owned(),
11 iat: 0,
12 exp: 100,
13 };
14 assert_tokens(
15 &claims,
16 &[
17 Token::Struct{name: "Claims", len: 3},
18 Token::String("tha"),
19 Token::String("hashed_string"),
20 Token::String("iat"),
21 Token::U64(0),
22 Token::String("exp"),
23 Token::U64(100),
24 Token::StructEnd,
25 ]
26 )
7 } 27 }
8 28
9 #[test] 29 #[test]