-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] LocatorResourcePool: Wait for resources in prepare step (#719)
Issue was introduced with #695.
- Loading branch information
Showing
2 changed files
with
17 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -1,8 +1,24 @@ | ||
const test = require("ava"); | ||
const LocatorResourcePool = require("../../../../lib/lbt/resources/LocatorResourcePool"); | ||
const Resource = require("@ui5/fs").Resource; | ||
|
||
test("getIgnoreMissingModules", async (t) => { | ||
const resourcePool = new LocatorResourcePool({ignoreMissingModules: true}); | ||
t.true(resourcePool.getIgnoreMissingModules(), "ignoreMissingModules is true"); | ||
}); | ||
|
||
test("wait for resources to finish prepare", async (t) => { | ||
let promiseResolved = false; | ||
const promise = new Promise((resolve) => { | ||
setTimeout(() => { | ||
promiseResolved = true; | ||
resolve(); | ||
}, 10); | ||
}); | ||
const resourcePool = new LocatorResourcePool(); | ||
resourcePool.addResource = () => promise; | ||
return resourcePool.prepare([new Resource({path: "mypath"})]).then(() => { | ||
t.true(promiseResolved, "addResources promise is resolved before prepare promise is resolved"); | ||
}); | ||
}); | ||
|