From 967918d31c1c01430554b8a60a6c7bc9688c6f42 Mon Sep 17 00:00:00 2001 From: Seraphina Orsini <29002354+finn-orsini@users.noreply.github.com> Date: Mon, 21 Aug 2023 16:54:20 -0400 Subject: [PATCH 1/2] fix: handle null args --- src/seed/SeedManager.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/seed/SeedManager.ts b/src/seed/SeedManager.ts index 67412c3..e8c8f1a 100644 --- a/src/seed/SeedManager.ts +++ b/src/seed/SeedManager.ts @@ -117,7 +117,8 @@ export default class SeedManager { ) { const argsMatch = Object.entries(source).every( ([argumentName, argumentValue]) => { - if (typeof argumentValue === 'object') { + // null is an object, exclude it from this check + if (typeof argumentValue === 'object' && argumentValue != null) { return this.matchArguments(argumentValue, target[argumentName]); } return isEqual(target[argumentName], argumentValue); @@ -130,7 +131,8 @@ export default class SeedManager { // eslint-disable-next-line @typescript-eslint/no-explicit-any private argumentCount(args: Record) { return Object.entries(args).reduce((acc, [, value]) => { - if (typeof value === 'object') { + // null is an object, exclude it from this check + if (typeof value === 'object' && value != null) { return acc + this.argumentCount(value) + 1; } From b4c0552b74f0c8fcee74c136cb96f0d7f8833a82 Mon Sep 17 00:00:00 2001 From: Seraphina Orsini <29002354+finn-orsini@users.noreply.github.com> Date: Mon, 21 Aug 2023 17:39:36 -0400 Subject: [PATCH 2/2] verion bump --- CHANGELOG.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37875d2..f16f773 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ and this project adheres to ## [Unreleased] +## [v1.1.2] - 2023-08-21 + +### Fixed + +- fix: handle null arguments + ## [v1.1.1] - 2023-08-09 ### Fixed diff --git a/package.json b/package.json index 5d263b9..1768138 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wayfair/gqmock", - "version": "1.1.1", + "version": "1.1.2", "description": "GQMock - GraphQL Mocking Service", "main": "dist/index.js", "types": "dist/index.d.ts",