Skip to content

Commit

Permalink
style: run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
fedeci committed Feb 16, 2024
1 parent bd17cea commit 8f500c3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/express-validator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ describe('ExpressValidator', () => {
describe('High level tests', () => {
const { body } = new ExpressValidator();
it('should error when .exists() is used on a nested field of a primitive', async () => {
const req = { body: { foo: "hello" } };
const result = await body("foo.nop").exists().run(req);
const req = { body: { foo: 'hello' } };
const result = await body('foo.nop').exists().run(req);
expect(result.isEmpty()).toEqual(false);
})
});
it('should not error when .not().exists() is used on a nested field of a primitive', async () => {
const req = { body: { foo: 'hello' } };
const result = await body('foo.nop').not().exists().run(req);
Expand All @@ -183,4 +183,4 @@ describe('High level tests', () => {
const result = await body('foo.*.nop').exists().run(req);
expect(result.isEmpty()).toEqual(true);
});
})
});
2 changes: 1 addition & 1 deletion src/field-selection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ describe('selectFields()', () => {
});

it('selects inexistent properties', () => {
const instances = selectFields({ cookies: { } }, ['foo.bar.baz'], ['cookies']);
const instances = selectFields({ cookies: {} }, ['foo.bar.baz'], ['cookies']);

expect(instances).toHaveLength(1);
expect(instances[0]).toEqual({
Expand Down
6 changes: 3 additions & 3 deletions src/field-selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ function expandPath(object: any, path: string | string[], currPath: readonly str
// globstar leaves are always selected
return [reconstructFieldPath(currPath)];
}
return []
return [];
}
if (key === "*") {
if (key === '*') {
// wildcard position does not exist
return []
return [];
}
// value is a primitive, there are still still paths to traverse that will be likely undefined, we return the entire path
return [reconstructFieldPath([...currPath, ...segments])];
Expand Down

0 comments on commit 8f500c3

Please sign in to comment.