From 1bff3e5b3165bac593f1f227275723d77b82e886 Mon Sep 17 00:00:00 2001 From: Noah Overcash Date: Fri, 13 Dec 2024 14:06:30 -0500 Subject: [PATCH] test fix --- .../QueryBuilder/helpers/upgradeInitialValues.js | 2 +- .../helpers/upgradeInitialValues.test.js | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/QueryBuilder/QueryBuilder/helpers/upgradeInitialValues.js b/src/QueryBuilder/QueryBuilder/helpers/upgradeInitialValues.js index b21d194a..0aded347 100644 --- a/src/QueryBuilder/QueryBuilder/helpers/upgradeInitialValues.js +++ b/src/QueryBuilder/QueryBuilder/helpers/upgradeInitialValues.js @@ -12,7 +12,7 @@ */ export default function upgradeInitialValues(initialValues, entityType) { if (!initialValues) { - return initialValues; + return undefined; } const withoutVersion = { ...initialValues }; diff --git a/src/QueryBuilder/QueryBuilder/helpers/upgradeInitialValues.test.js b/src/QueryBuilder/QueryBuilder/helpers/upgradeInitialValues.test.js index 301c45e3..9fac8d28 100644 --- a/src/QueryBuilder/QueryBuilder/helpers/upgradeInitialValues.test.js +++ b/src/QueryBuilder/QueryBuilder/helpers/upgradeInitialValues.test.js @@ -10,13 +10,16 @@ describe('initial values legacy conversion', () => { [undefined, undefined], [null, {}], [undefined, {}], - [{}, null], - [{}, undefined], - ])('ignores initialValues=%s and entityType=%s', (initialValues, entityType) => { - expect(upgradeInitialValues(initialValues, entityType)).toStrictEqual(initialValues); + [{ _version: '1' }, null], + [{ _version: '1' }, undefined], + [{ _version: '1' }, null], + [{ _version: '1' }, undefined], + [{ _version: '1' }, {}], + ])('considers initialValues=%s and entityType=%s as a new query', (initialValues, entityType) => { + expect(upgradeInitialValues(initialValues, entityType)).toStrictEqual(undefined); }); - it.each([{}, { foo: '' }, { bar: '' }, { foo: '', bar: '' }])( + it.each([{ foo: '' }, { bar: '' }, { foo: '', bar: '' }])( 'processes but does not convert non-id columns in %s', (values) => { expect(upgradeInitialValues(values, ENTITY_TYPE)).toStrictEqual(values);