Skip to content

Commit

Permalink
feat: πŸ”₯ Fix reversed logic and corresponding tests
Browse files Browse the repository at this point in the history
βœ… Closes: #220
  • Loading branch information
Ryan Smee committed May 6, 2022
1 parent 2d0aecc commit dbddca3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/falso/src/lib/core/unique-validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export const objectIsUnique: (
}

if (items.some((arrayItem) => arrayItem[key] === item[key])) {
return true;
return false;
}
}

return false;
return true;
};
12 changes: 6 additions & 6 deletions packages/falso/src/tests/core/object-is-unique.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ describe('objectIsUnique', () => {
array[1].id = sharedId;
});

it('should return true', () => {
it('should return false', () => {
const result = objectIsUnique(newItem, array, keys);

expect(result).toEqual(true);
expect(result).toEqual(false);
});
});

Expand All @@ -60,7 +60,7 @@ describe('objectIsUnique', () => {
it('should return true', () => {
const result = objectIsUnique(newItem, array, keys);

expect(result).toEqual(false);
expect(result).toEqual(true);
});
});
});
Expand All @@ -85,10 +85,10 @@ describe('objectIsUnique', () => {
array[1].firstName = sharedFirstName;
});

it('should return true', () => {
it('should return false', () => {
const result = objectIsUnique(newItem, array, keys);

expect(result).toEqual(true);
expect(result).toEqual(false);
});
});

Expand All @@ -107,7 +107,7 @@ describe('objectIsUnique', () => {
it('should return true', () => {
const result = objectIsUnique(newItem, array, keys);

expect(result).toEqual(false);
expect(result).toEqual(true);
});
});
});
Expand Down

0 comments on commit dbddca3

Please sign in to comment.