Skip to content

Commit 98b7d89

Browse files
committed
Tests
1 parent ae851e3 commit 98b7d89

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/query/minify.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,31 @@ pub fn minify_query(source: String) -> Result<String, ParseError> {
2929
}
3030

3131
Ok(bits.join(""))
32+
}
33+
34+
#[cfg(test)]
35+
mod tests {
36+
#[test]
37+
fn strip_ignored_characters() {
38+
let source = "
39+
query SomeQuery($foo: String!, $bar: String) {
40+
someField(foo: $foo, bar: $bar) {
41+
a
42+
b {
43+
... on B {
44+
c
45+
d
46+
}
47+
}
48+
}
49+
}
50+
";
51+
52+
let minified = super::minify_query(source.to_string()).expect("minification failed");
53+
54+
assert_eq!(
55+
&minified,
56+
"query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{...on B{c d}}}}"
57+
);
58+
}
3259
}

0 commit comments

Comments
 (0)