From c2cfd81bda1ac964a194c80c88b957d2d7077aec Mon Sep 17 00:00:00 2001 From: Chesterkxng Date: Tue, 25 Jun 2024 21:02:42 +0000 Subject: [PATCH] testing the case step equal to 0 --- .../number/generate/generate.service.test.ts | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/pages/number/generate/generate.service.test.ts b/src/pages/number/generate/generate.service.test.ts index fb5bc41..f20625b 100644 --- a/src/pages/number/generate/generate.service.test.ts +++ b/src/pages/number/generate/generate.service.test.ts @@ -1,6 +1,6 @@ // Import necessary modules and functions import { describe, it, expect } from 'vitest'; -import { listOfIntegers } from './service'; +import { listOfIntegers} from './service'; // Define test cases for the listOfIntegers function describe('listOfIntegers function', () => { @@ -53,4 +53,24 @@ describe('listOfIntegers function', () => { const result = listOfIntegers(initialValue, count, step, separator); expect(result).toBe('-10 -7.5 -5 -2.5 0'); }); -}); \ No newline at end of file + + it('should generate a constant sequence if the step is 0', () => { + const initialValue = 1; + const step = 0; + const count = 5; + const separator = ' '; + + const result = listOfIntegers(initialValue, count, step, separator); + expect(result).toBe('1 1 1 1 1'); + }); + + it('should generate a constant sequence if the step is 0', () => { + const initialValue = 1; + const step = 0; + const count = 5; + const separator = ' '; + + const result = listOfIntegers(initialValue, count, step, separator); + expect(result).toBe('1 1 1 1 1'); + }); +});