From c270c7a55f5b953ab35ef5805c8e67dcff7e4560 Mon Sep 17 00:00:00 2001 From: Sofiya Tepikin Date: Fri, 4 Dec 2020 19:33:25 +0100 Subject: [PATCH] Add tests to the getOrdinalSuffix function --- test/home-helpers.spec.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/home-helpers.spec.js diff --git a/test/home-helpers.spec.js b/test/home-helpers.spec.js new file mode 100644 index 0000000..696a7b9 --- /dev/null +++ b/test/home-helpers.spec.js @@ -0,0 +1,25 @@ +import { expect } from 'chai' + +import {getOrdinalSuffix } from '../components/helpers/home' + +describe('Home helper: getOrdinalSuffix', () => { + it('For 1, it returns suffix \'st\'', () => { + expect(getOrdinalSuffix(1)).to.eql('st') + }) + + it('For 2, it returns suffix \'nd\'', () => { + expect(getOrdinalSuffix(2)).to.eql('nd') + }) + + it('For 3, it returns suffix \'rd\'', () => { + expect(getOrdinalSuffix(3)).to.eql('rd') + }) + + it('For 11, it returns suffix \'th\'', () => { + expect(getOrdinalSuffix(11)).to.eql('th') + }) + + it('For 23, it returns suffix \'rd\'', () => { + expect(getOrdinalSuffix(23)).to.eql('rd') + }) +})