MCPcopy
hub / github.com/jestjs/jest / equals

Method equals

packages/expect/src/__tests__/customEqualityTesters.test.ts:25–33  ·  view source on GitHub ↗
(other: Volume)

Source from the content-addressed store, hash-verified

23 }
24
25 equals(other: Volume): boolean {
26 if (this.unit === other.unit) {
27 return this.amount === other.amount;
28 } else if (this.unit === 'L' && other.unit === 'mL') {
29 return this.amount * 1000 === other.amount;
30 } else {
31 return this.amount === other.amount * 1000;
32 }
33 }
34}
35
36function createVolume(amount: number, unit: 'L' | 'mL' = 'L') {

Callers 7

areBooksEqualFunction · 0.80
toEqualBookFunction · 0.80
shouldNotErrorFunction · 0.80
toBeOneFunction · 0.80
areVolumesEqualFunction · 0.80
toEqualVolumeFunction · 0.80
_toMatchSnapshotFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected