1
0
Fork 0

test schema rule selecting 0 items

This commit is contained in:
ssube 2019-11-13 23:38:41 -06:00 committed by Sean Sube
parent c9b6c9fe4e
commit 761c64851c
1 changed files with 25 additions and 0 deletions

View File

@ -36,6 +36,31 @@ describeLeaks('schema rule', async () => {
expect(results).to.deep.equal([data.foo]); expect(results).to.deep.equal([data.foo]);
}); });
itLeaks('should pick no items', async () => {
const ctx = new VisitorContext({
logger: NullLogger.global,
schemaOptions: {
coerce: false,
defaults: false,
mutate: false,
},
});
const data = {
bar: 3,
};
const rule = new SchemaRule({
check: {},
desc: '',
level: LogLevel.Info,
name: 'foo',
select: '$.foo',
tags: [],
});
const results = await rule.pick(ctx, data);
expect(results).to.deep.equal([]);
});
itLeaks('should filter out items', async () => { itLeaks('should filter out items', async () => {
const ctx = new VisitorContext({ const ctx = new VisitorContext({
logger: NullLogger.global, logger: NullLogger.global,