promise-the-world
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -17,2 +17,6 @@ const defer = require('./defer') | ||
unlock () { | ||
if (!this._lock) { | ||
return | ||
} | ||
this._lock.resolve() | ||
@@ -19,0 +23,0 @@ this._lock = null |
{ | ||
"name": "promise-the-world", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A complete Promise utils collection", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -57,3 +57,32 @@ const { strictEqual } = require('assert') | ||
}) | ||
it('should do nothing if the mutex is not yet locked', async () => { | ||
let error = null | ||
const m = mutex() | ||
try { | ||
m.unlock() | ||
} catch (err) { | ||
error = err | ||
} | ||
strictEqual(error, null) | ||
}) | ||
it('should do nothing if the mutex is already unlocked', async () => { | ||
let error = null | ||
const m = mutex() | ||
await m.lock() | ||
m.unlock() | ||
try { | ||
m.unlock() | ||
} catch (err) { | ||
error = err | ||
} | ||
strictEqual(error, null) | ||
}) | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15700
391