Skip to content

Commit

Permalink
Make the tests work with async api mock
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrze committed Oct 12, 2023
1 parent 5129268 commit de82a3e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/modules/dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ const resolveDependencies = async (modules, getVersions) => {
});
})
);
const dependenciesVersions = resolveBestVersion(dependenciesList, getVersions);
const dependenciesDependencies = resolveDependencies(dependenciesVersions, getVersions);
const dependenciesVersions = await resolveBestVersion(dependenciesList, getVersions);
const dependenciesDependencies = await resolveDependencies(dependenciesVersions, getVersions);

return {...{...deps, ...dependenciesVersions}, ...dependenciesDependencies};
}
Expand Down
6 changes: 3 additions & 3 deletions test/lib/modules/dependencies.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const dependencies = require('../../../lib/modules/dependencies');
const isEqual = require('lodash.isequal');

test('returns empty hash if there is a problem loading configuration file', () => {
test('returns empty hash if there is a problem loading configuration file', async () => {
const core = {"module":"core","versions":{"1.0.0":{"dependencies":{}}, "1.5.0":{"dependencies":{}}, "1.6.0":{"dependencies":{}}, "1.8.0":{"dependencies":{}}}};
const modulesVersions = (modulesNames) => {
const modulesVersions = async (modulesNames) => {
// console.log('hit');
if(isEqual(modulesNames, ['payments_stripe', 'tests', 'a'])) {
return [
Expand All @@ -29,7 +29,7 @@ test('returns empty hash if there is a problem loading configuration file', () =
"a": "1.0.0"
};

const data = dependencies.resolveDependencies(rootModules, modulesVersions);
const data = await dependencies.resolveDependencies(rootModules, modulesVersions);

expect(data).toEqual(
{
Expand Down

0 comments on commit de82a3e

Please sign in to comment.