diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 26f368c..f002281 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,9 +4,9 @@
-
+
-
+
@@ -176,15 +176,7 @@
-
-
-
-
- 1718822309352
-
-
-
- 1718822309352
+
@@ -570,7 +562,15 @@
1719281605999
-
+
+
+ 1719282009150
+
+
+
+ 1719282009150
+
+
@@ -591,7 +591,6 @@
-
@@ -616,7 +615,8 @@
-
+
+
diff --git a/src/pages/number/sum/sum.service.test.ts b/src/pages/number/sum/sum.service.test.ts
index c18748e..1a3b21b 100644
--- a/src/pages/number/sum/sum.service.test.ts
+++ b/src/pages/number/sum/sum.service.test.ts
@@ -1,6 +1,64 @@
-import { expect, describe, it } from 'vitest';
-// import { } from './service';
-//
-// describe('sum', () => {
-//
-// })
\ No newline at end of file
+import { describe, it, expect } from 'vitest';
+import { compute } from './service';
+
+describe('compute function', () => {
+ it('should correctly sum numbers in smart extraction mode', () => {
+ const input = 'The 2 cats have 4 and 7 kittens';
+ const result = compute(input, 'smart', false, ',');
+ expect(result).toBe('13');
+ });
+
+ it('should correctly sum numbers with custom delimiter', () => {
+ const input = '2,4,7';
+ const result = compute(input, 'delimiter', false, ',');
+ expect(result).toBe('13');
+ });
+
+ it('should return running sum in smart extraction mode', () => {
+ const input = 'The 2 cats have 4 and 7 kittens';
+ const result = compute(input, 'smart', true, ',');
+ expect(result).toBe('2\n6\n13\n');
+ });
+
+ it('should return running sum with custom delimiter', () => {
+ const input = '2,4,7';
+ const result = compute(input, 'delimiter', true, ',');
+ expect(result).toBe('2\n6\n13\n');
+ });
+
+ it('should handle empty input gracefully in smart mode', () => {
+ const input = '';
+ const result = compute(input, 'smart', false, ',');
+ expect(result).toBe('0');
+ });
+
+ it('should handle empty input gracefully in delimiter mode', () => {
+ const input = '';
+ const result = compute(input, 'delimiter', false, ',');
+ expect(result).toBe('0');
+ });
+
+ it('should handle input with no numbers in smart mode', () => {
+ const input = 'There are no numbers here';
+ const result = compute(input, 'smart', false, ',');
+ expect(result).toBe('0');
+ });
+
+ it('should handle input with no numbers in delimiter mode', () => {
+ const input = 'a,b,c';
+ const result = compute(input, 'delimiter', false, ',');
+ expect(result).toBe('0');
+ });
+
+ it('should ignore non-numeric parts in delimiter mode', () => {
+ const input = '2,a,4,b,7';
+ const result = compute(input, 'delimiter', false, ',');
+ expect(result).toBe('13');
+ });
+
+ it('should handle different separators', () => {
+ const input = '2;4;7';
+ const result = compute(input, 'delimiter', false, ';');
+ expect(result).toBe('13');
+ });
+});