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 20be175
Show file tree
Hide file tree
Showing 2 changed files with 13 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
10 changes: 8 additions & 2 deletions tests/unit/core/traverse.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,21 @@ describe('Traverse', () => {
type: 'string',
generate: () => 'foo',
},
minItems: 1,
maxItems: 1,
};

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 20be175

Please sign in to comment.