From 434f276f293ca95da7d051ad684701885fb921e1 Mon Sep 17 00:00:00 2001 From: Sarah Dayan <5370675+sarahdayan@users.noreply.github.com> Date: Wed, 21 Jul 2021 01:52:59 +0200 Subject: [PATCH] fix: clean up --- .../autocomplete-core/src/__tests__/getSources.test.ts | 6 +++--- .../src/utils/__tests__/getNormalizedSources.test.ts | 6 +++--- .../autocomplete-shared/src/__tests__/decycle.test.ts | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/autocomplete-core/src/__tests__/getSources.test.ts b/packages/autocomplete-core/src/__tests__/getSources.test.ts index 2f4c27e5ba..bf27cd79d9 100644 --- a/packages/autocomplete-core/src/__tests__/getSources.test.ts +++ b/packages/autocomplete-core/src/__tests__/getSources.test.ts @@ -119,10 +119,10 @@ describe('getSources', () => { createSource({ sourceId: 'source1', getItems: () => { - const obj = { a: 'b', self: null }; - obj.self = obj; + const circular = { a: 'b', self: null }; + circular.self = circular; - return [obj]; + return [circular]; }, }), ]; diff --git a/packages/autocomplete-core/src/utils/__tests__/getNormalizedSources.test.ts b/packages/autocomplete-core/src/utils/__tests__/getNormalizedSources.test.ts index 06d22eef6a..1a5458b355 100644 --- a/packages/autocomplete-core/src/utils/__tests__/getNormalizedSources.test.ts +++ b/packages/autocomplete-core/src/utils/__tests__/getNormalizedSources.test.ts @@ -67,10 +67,10 @@ describe('getNormalizedSources', () => { }); test('with wrong `getSources` function return type containing circular references triggers invariant', async () => { - const cyclic = { self: null }; - cyclic.self = cyclic; + const circular = { self: null }; + circular.self = circular; - const getSources = () => cyclic; + const getSources = () => circular; const params = { query: '', state: createState({}), diff --git a/packages/autocomplete-shared/src/__tests__/decycle.test.ts b/packages/autocomplete-shared/src/__tests__/decycle.test.ts index d888aa7cfe..77a8e71689 100644 --- a/packages/autocomplete-shared/src/__tests__/decycle.test.ts +++ b/packages/autocomplete-shared/src/__tests__/decycle.test.ts @@ -3,13 +3,13 @@ import { decycle } from '../decycle'; describe('decycle', () => { if (__DEV__) { test('leaves objects with no circular references intact', () => { - const obj = { a: 1 }; - const subject = { + const ref = { a: 1 }; + const obj = { a: 'b', - c: { d: [obj, () => {}, null, false, undefined] }, + c: { d: [ref, () => {}, null, false, undefined] }, }; - expect(decycle(subject)).toEqual({ + expect(decycle(obj)).toEqual({ a: 'b', c: { d: [{ a: 1 }, expect.any(Function), null, false, undefined] }, });