summary refs log tree commit diff stats
path: root/javascript/raindrops/raindrops.spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'javascript/raindrops/raindrops.spec.js')
-rw-r--r--javascript/raindrops/raindrops.spec.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/javascript/raindrops/raindrops.spec.js b/javascript/raindrops/raindrops.spec.js
new file mode 100644
index 0000000..7d16076
--- /dev/null
+++ b/javascript/raindrops/raindrops.spec.js
@@ -0,0 +1,52 @@
+import { convert } from './raindrops';
+
+describe('Raindrops', () => {
+  test('the sound for 1 is 1', () => expect(convert(1)).toEqual('1'));
+
+  test('the sound for 3 is Pling', () => expect(convert(3)).toEqual('Pling'));
+
+  test('the sound for 5 is Plang', () => expect(convert(5)).toEqual('Plang'));
+
+  test('the sound for 7 is Plong', () => expect(convert(7)).toEqual('Plong'));
+
+  test('the sound for 6 is Pling as it has a factor 3', () =>
+    expect(convert(6)).toEqual('Pling'));
+
+  test('2 to the power 3 does not make a raindrop sound as 3 is the exponent not the base', () =>
+    expect(convert(8)).toEqual('8'));
+
+  test('the sound for 9 is Pling as it has a factor 3', () =>
+    expect(convert(9)).toEqual('Pling'));
+
+  test('the sound for 10 is Plang as it has a factor 5', () =>
+    expect(convert(10)).toEqual('Plang'));
+
+  test('the sound for 14 is Plong as it has a factor of 7', () =>
+    expect(convert(14)).toEqual('Plong'));
+
+  test('the sound for 15 is PlingPlang as it has factors 3 and 5', () =>
+    expect(convert(15)).toEqual('PlingPlang'));
+
+  test('the sound for 21 is PlingPlong as it has factors 3 and 7', () =>
+    expect(convert(21)).toEqual('PlingPlong'));
+
+  test('the sound for 25 is Plang as it has a factor 5', () =>
+    expect(convert(25)).toEqual('Plang'));
+
+  test('the sound for 27 is Pling as it has a factor 3', () =>
+    expect(convert(27)).toEqual('Pling'));
+
+  test('the sound for 35 is PlangPlong as it has factors 5 and 7', () =>
+    expect(convert(35)).toEqual('PlangPlong'));
+
+  test('the sound for 49 is Plong as it has a factor 7', () =>
+    expect(convert(49)).toEqual('Plong'));
+
+  test('the sound for 52 is 52', () => expect(convert(52)).toEqual('52'));
+
+  test('the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7', () =>
+    expect(convert(105)).toEqual('PlingPlangPlong'));
+
+  test('the sound for 3125 is Plang as it has a factor 5', () =>
+    expect(convert(3125)).toEqual('Plang'));
+});