import { getOfferDisplayName } from '../../../src/helpers/offer'; import { expect } from 'chai'; describe('helper offer', () => { describe('returns an empty string', () => { it('if an offer map is not passed', () => { expect(getOfferDisplayName('1234')).to.eq(''); }); it('if an the offer ID is not present on the offers map', () => { expect(getOfferDisplayName('1234', { '123': 'Not matching', '456': 'Not matching me neither', })).to.eq(''); }); }); describe('returns a display name', () => { it('if an offer id is present in the offers map', () => { expect(getOfferDisplayName('1234', { 'abc': 'Not matching', '1234': 'Matching!' })).to.eq('Matching!'); }); }); });