Explorar el Código

Add a test

master
Dylan Baker hace 5 años
padre
commit
e40d91a5ec
Se han modificado 1 ficheros con 17 adiciones y 0 borrados
  1. 17
    0
      src/snippet.rs

+ 17
- 0
src/snippet.rs Ver fichero

@@ -88,3 +88,20 @@ pub fn insert(snippet: ApiSnippet, connection: &PGC) -> QueryResult<Snippet> {
88 88
         .values(formatted_snippet)
89 89
         .get_result(connection)
90 90
 }
91
+
92
+#[cfg(test)]
93
+mod tests {
94
+    use super::*;
95
+
96
+    #[test]
97
+    fn identical_snippets_have_different_uuids() {
98
+        let snippet = ApiSnippet {
99
+            title: String::from("Hello world"),
100
+            body: String::from("Hello world"),
101
+            filetype: None,
102
+        };
103
+        let uuid1 = generate_uuid(&snippet);
104
+        let uuid2 = generate_uuid(&snippet);
105
+        assert!(uuid1 != uuid2);
106
+    }
107
+}

Loading…
Cancelar
Guardar