|
| 1 | +import { removeTaskPrefix } from "../src/utils/helpers"; |
| 2 | + |
| 3 | +describe("removeTaskPrefix", () => { |
| 4 | + test('removes "Task: "', () => { |
| 5 | + const input = "Task: This is a sample task"; |
| 6 | + const output = removeTaskPrefix(input); |
| 7 | + expect(output).toBe("This is a sample task"); |
| 8 | + }); |
| 9 | + |
| 10 | + test('removes "Task {N}: "', () => { |
| 11 | + const input = |
| 12 | + "Task 1: Perform a comprehensive analysis of the current system's performance."; |
| 13 | + const output = removeTaskPrefix(input); |
| 14 | + expect(output).toBe( |
| 15 | + "Perform a comprehensive analysis of the current system's performance." |
| 16 | + ); |
| 17 | + }); |
| 18 | + |
| 19 | + test('removes "Task {N}. "', () => { |
| 20 | + const input = "Task 2. Create a python script"; |
| 21 | + const output = removeTaskPrefix(input); |
| 22 | + expect(output).toBe("Create a python script"); |
| 23 | + }); |
| 24 | + |
| 25 | + test('removes "{N} - "', () => { |
| 26 | + const input = "5 - This is a sample task"; |
| 27 | + const output = removeTaskPrefix(input); |
| 28 | + expect(output).toBe("This is a sample task"); |
| 29 | + }); |
| 30 | + |
| 31 | + test('removes "{N}: "', () => { |
| 32 | + const input = "2: This is a sample task"; |
| 33 | + const output = removeTaskPrefix(input); |
| 34 | + expect(output).toBe("This is a sample task"); |
| 35 | + }); |
| 36 | + |
| 37 | + test("does not modify strings without matching prefixes", () => { |
| 38 | + const input = "This is a sample task without a prefix"; |
| 39 | + const output = removeTaskPrefix(input); |
| 40 | + expect(output).toBe(input); |
| 41 | + }); |
| 42 | +}); |
0 commit comments