Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Conversions/test/ArbitraryBase.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { convertArbitraryBase } from '../ArbitraryBase'

test('Check the answer of convertArbitraryBase(98, 0123456789, 01234567) is 142', () => {
const res = convertArbitraryBase('98', '0123456789', '01234567')
expect(res).toBe('142')
})

test('Check the answer of convertArbitraryBase(98, 0123456789, abcdefgh) is bec', () => {
const res = convertArbitraryBase('98', '0123456789', 'abcdefgh')
expect(res).toBe('bec')
})

test('Check the answer of convertArbitraryBase(98, 0123456789, 98765432) is 857', () => {
const res = convertArbitraryBase('98', '0123456789', '98765432')
expect(res).toBe('857')
})

test('Check the answer of convertArbitraryBase(129, 0123456789, 01234567) is 201', () => {
const res = convertArbitraryBase('129', '0123456789', '01234567')
expect(res).toBe('201')
})

test('Check the answer of convertArbitraryBase(112, 0123456789, 12345678) is 271', () => {
const res = convertArbitraryBase('112', '0123456789', '12345678')
expect(res).toBe('271')
})

test('Check the answer of convertArbitraryBase(112, 0123456789, 123456789) is 245', () => {
const res = convertArbitraryBase('112', '0123456789', '123456789')
expect(res).toBe('245')
})

test('Check the answer of convertArbitraryBase(111, 0123456789, abcdefgh) is bfh', () => {
const res = convertArbitraryBase('111', '0123456789', 'abcdefgh')
expect(res).toBe('bfh')
})
21 changes: 21 additions & 0 deletions Conversions/test/DateDayDiffernce.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { DateDayDifference } from '../DateDayDifference'

test('The difference between 17/08/2002 & 10/10/2020 is 6630', () => {
const res = DateDayDifference('17/08/2002', '10/10/2020')
expect(res).toBe(6630)
})

test('The difference between 18/02/2001 & 16/03/2022 is 7696', () => {
const res = DateDayDifference('18/02/2001', '16/03/2022')
expect(res).toBe(7696)
})

test('The difference between 11/11/2011 & 12/12/2012 is 398', () => {
const res = DateDayDifference('11/11/2011', '12/12/2012')
expect(res).toBe(398)
})

test('The difference between 01/01/2001 & 16/03/2011 is 3727', () => {
const res = DateDayDifference('01/01/2001', '16/03/2011')
expect(res).toBe(3727)
})
20 changes: 20 additions & 0 deletions Conversions/test/DateToDay.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { DateToDay } from '../DateToDay'

test('The date 18/02/2001 is Monday', () => {
const res = DateToDay('18/02/2001')
expect(res).toBe('Monday')
})

test('The date 18/12/2020 is Friday', () => {
const res = DateToDay('18/12/2020')
expect(res).toBe('Friday')
})

test('The date 12/12/2012 is Wednesday', () => {
const res = DateToDay('12/12/2012')
expect(res).toBe('Wednesday')
})
test('The date 01/01/2001 is Friday', () => {
const res = DateToDay('01/01/2001')
expect(res).toBe('Friday')
})