Permalink
Browse files

Unit tests

  • Loading branch information...
dandean committed Nov 15, 2010
1 parent 57f4a60 commit 47e235776d197d7a7f2c369ac4ab441ae03ddfda
Showing with 14 additions and 0 deletions.
  1. +14 −0 tests.js
View
@@ -0,0 +1,14 @@
+var Uuid = require("./uuid-lib"),
+ Assert = require("assert");
+
+var empty = Uuid.EMPTY,
+ uuid = Uuid.create();
+ raw = Uuid.raw();
+
+Assert.equal('00000000000000000000000000000000', empty, 'Empty UUID is not the correct value.');
+Assert.ok(Uuid.isUuid(empty), "EMPTY should be a valid UUID.");
+Assert.ok(Uuid.isUuid(uuid), "Uuid object should be a valid UUID");
+Assert.ok(Uuid.isUuid(raw), "UUID string should be a valid UUID");
+Assert.ok(uuid instanceof Uuid, "Uuid instance should be instanceof Uuid.");
+Assert.ok((raw instanceof Uuid) == false, "Result of raw() should not be instanceof Uuid.");
+Assert.ok(Object.prototype.toString.call(raw) == '[object String]', "Result of raw() should be a string");

0 comments on commit 47e2357

Please sign in to comment.