Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pateketrueke committed Nov 7, 2024
1 parent 37cd9e9 commit 6554f93
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/lib/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ jsf.resolveWithContext = (schema, refs, cwd) => {
refs = {};
}

// investigate this!!
if (!schema) {
return Promise.resolve({});
}

// normalize basedir (browser aware)
cwd = cwd || (typeof process !== 'undefined' && typeof process.cwd === 'function' ? process.cwd() : '');
cwd = `${cwd.replace(/\/+$/, '')}/`;
Expand Down
9 changes: 7 additions & 2 deletions tests/unit/core/traverse.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,16 @@ describe('Traverse', () => {
};

expect(traverse(schema, [], mockResolve, schema)).to.eql({
value: [],
value: ['foo'],
context: {
schemaPath: [],
title: schema.title,
items: []
items: [
{
schemaPath: ['items'],
description: schema.items.description,
},
],
},
});
});
Expand Down

0 comments on commit 6554f93

Please sign in to comment.