since you have this logic twice (in the .toEqual and .toBe versions), add it to a beforeEach() block, and use it both places