Skip to content

Commit

Permalink
Unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dandean committed Nov 15, 2010
1 parent 57f4a60 commit 47e2357
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests.js
Original file line number Original file line Diff line number Diff line change
@@ -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.