From 761c64851c8f55546deb94e383a0001d66411104 Mon Sep 17 00:00:00 2001 From: ssube Date: Wed, 13 Nov 2019 23:38:41 -0600 Subject: [PATCH] test schema rule selecting 0 items --- test/rule/TestSchemaRule.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/rule/TestSchemaRule.ts b/test/rule/TestSchemaRule.ts index fbe5865..c4860ac 100644 --- a/test/rule/TestSchemaRule.ts +++ b/test/rule/TestSchemaRule.ts @@ -36,6 +36,31 @@ describeLeaks('schema rule', async () => { 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 () => { const ctx = new VisitorContext({ logger: NullLogger.global,