Skip to content

Commit

Permalink
fix: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahdayan committed Jul 20, 2021
1 parent 1d50f0c commit 434f276
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions packages/autocomplete-core/src/__tests__/getSources.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
},
}),
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({}),
Expand Down
8 changes: 4 additions & 4 deletions packages/autocomplete-shared/src/__tests__/decycle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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] },
});
Expand Down

0 comments on commit 434f276

Please sign in to comment.