         let post = TestDataBuilder.anyPost(slugUrl: title)
         XCTAssertEqual(expectedSlugUrl, post.slugUrl)
     }
+    
+    func testSlugUrlGivenUniqueNameIfDuplicate() {
+        let title = "A duplicated title"
+        let expectedSlugUrl = "a-duplicated-title-2"
+        do {
+            var post1 = TestDataBuilder.anyPost(slugUrl: title)
+            try post1.save()
+            let post2 = TestDataBuilder.anyPost(slugUrl: title)
+            XCTAssertEqual(expectedSlugUrl, post2.slugUrl)
+        }
+        catch {
+            XCTFail("Test threw unexpected exception")
+        }
+    }
 
     // TODO test snippets
-    // TODO test slug Url uniqueness logic
     // TODO test tag pivot logic
 
 }

        return BlogPost(title: "An Exciting Post!", contents: "<p>This is a blog post</p>", author: anyUser(), creationDate: Date(), slugUrl: slugUrl)
    }
}

        ("testSlugUrlLowerCases", testSlugUrlLowerCases),
        ("testEverythingWithLotsOfCharacters", testEverythingWithLotsOfCharacters),
    ]
    
    override func setUp() {
        let database = Database(MemoryDriver())
        BlogPost.database = database
        let fakeConsole = Terminal(arguments: [])
        let prepare = Prepare(console: fakeConsole, preparations: [BlogPost.self], database: database)
        do {
            try prepare.run(arguments: [])
        }
        catch {
            XCTFail("failed to prepapre DB")
        }
    }

    func testThatSlugUrlCalculatedCorrectlyForTitleWithSpaces() {
        let title = "This is a title"
