Skip to content

Commit 51bdc1b

Browse files
committed
Use 'should' pattern for test descriptions
1 parent b2a8465 commit 51bdc1b

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

tests/unit/memoizedShallowEqualTest.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,30 @@ import memoizedShallowEqual from '../../lib/memoizedShallowEqual';
22

33
describe('memoizedShallowEqual', () => {
44
describe('shallowEqual semantics', () => {
5-
it('returns true for the same reference', () => {
5+
it('should return true for the same reference', () => {
66
const obj = {a: 1};
77
expect(memoizedShallowEqual(obj, obj)).toBe(true);
88
});
99

10-
it('returns true for different references with shallowly-equal content', () => {
10+
it('should return true for different references with shallowly-equal content', () => {
1111
const member = {name: 'John'};
1212
expect(memoizedShallowEqual({a: 1, member}, {a: 1, member})).toBe(true);
1313
});
1414

15-
it('returns false when a top-level value differs', () => {
15+
it('should return false when a top-level value differs', () => {
1616
expect(memoizedShallowEqual({a: 1}, {a: 2})).toBe(false);
1717
});
1818

19-
it('returns false when key counts differ', () => {
19+
it('should return false when key counts differ', () => {
2020
expect(memoizedShallowEqual({a: 1}, {a: 1, b: 2})).toBe(false);
2121
});
2222

23-
it('returns false for equal deep content with different nested references', () => {
23+
it('should return false for equal deep content with different nested references', () => {
2424
// Shallow, not deep: nested objects are compared by reference.
2525
expect(memoizedShallowEqual({member: {name: 'John'}}, {member: {name: 'John'}})).toBe(false);
2626
});
2727

28-
it('handles non-object inputs', () => {
28+
it('should handle non-object inputs', () => {
2929
expect(memoizedShallowEqual(undefined, undefined)).toBe(true);
3030
expect(memoizedShallowEqual(undefined, {})).toBe(false);
3131
expect(memoizedShallowEqual('a', 'a')).toBe(true);
@@ -34,14 +34,14 @@ describe('memoizedShallowEqual', () => {
3434
expect(memoizedShallowEqual(NaN, NaN)).toBe(true);
3535
});
3636

37-
it('handles arrays', () => {
37+
it('should handle arrays', () => {
3838
expect(memoizedShallowEqual([1, 2], [1, 2])).toBe(true);
3939
expect(memoizedShallowEqual([1, 2], [1, 3])).toBe(false);
4040
});
4141
});
4242

4343
describe('memoization', () => {
44-
it('returns the cached verdict for the same object pair without re-comparing', () => {
44+
it('should return the cached verdict for the same object pair without re-comparing', () => {
4545
const a = {name: 'John'};
4646
const b = {name: 'Jane'};
4747
expect(memoizedShallowEqual(a, b)).toBe(false);
@@ -53,7 +53,7 @@ describe('memoizedShallowEqual', () => {
5353
expect(memoizedShallowEqual(a, b)).toBe(false);
5454
});
5555

56-
it('caches verdicts per pair, not per object', () => {
56+
it('should cache verdicts per pair, not per object', () => {
5757
const a = {x: 1};
5858
const equalToA = {x: 1};
5959
const differentFromA = {x: 2};
@@ -66,7 +66,7 @@ describe('memoizedShallowEqual', () => {
6666
expect(memoizedShallowEqual(a, differentFromA)).toBe(false);
6767
});
6868

69-
it('does not memoize non-object inputs', () => {
69+
it('should not memoize non-object inputs', () => {
7070
// Primitives cannot be WeakMap keys; these calls must not throw and must compare directly.
7171
expect(memoizedShallowEqual(1, {})).toBe(false);
7272
expect(memoizedShallowEqual({}, 1)).toBe(false);

0 commit comments

Comments
 (0)