Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
(function() { | ||
var assert = require("assert"), | ||
Lock = require("../lib/Lock"), | ||
LockQueueManager = require("../lib/LockQueueManager"); | ||
|
||
suite("Lock", function() { | ||
suite("new Lock()", function() { | ||
test("new Lock() should create lock with given name", function(done) { | ||
var lock = new Lock("pew", new LockQueueManager()); | ||
|
||
assert.equal("pew", lock.getName()); | ||
|
||
done(); | ||
}); | ||
|
||
test("new Lock() should only accept LockQueueManager as manager argument", function(done) { | ||
try { | ||
new Lock("pew", {}); | ||
} catch (error) { | ||
return done(); | ||
} | ||
|
||
done(new Error("Invalid manager accepted")); | ||
}); | ||
}); | ||
}); | ||
})(); |