-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathremove-task-prefix.test.ts
More file actions
42 lines (36 loc) · 1.32 KB
/
remove-task-prefix.test.ts
File metadata and controls
42 lines (36 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { removeTaskPrefix } from "../src/utils/helpers";
describe("removeTaskPrefix", () => {
test('removes "Task: "', () => {
const input = "Task: This is a sample task";
const output = removeTaskPrefix(input);
expect(output).toBe("This is a sample task");
});
test('removes "Task {N}: "', () => {
const input =
"Task 1: Perform a comprehensive analysis of the current system's performance.";
const output = removeTaskPrefix(input);
expect(output).toBe(
"Perform a comprehensive analysis of the current system's performance."
);
});
test('removes "Task {N}. "', () => {
const input = "Task 2. Create a python script";
const output = removeTaskPrefix(input);
expect(output).toBe("Create a python script");
});
test('removes "{N} - "', () => {
const input = "5 - This is a sample task";
const output = removeTaskPrefix(input);
expect(output).toBe("This is a sample task");
});
test('removes "{N}: "', () => {
const input = "2: This is a sample task";
const output = removeTaskPrefix(input);
expect(output).toBe("This is a sample task");
});
test("does not modify strings without matching prefixes", () => {
const input = "This is a sample task without a prefix";
const output = removeTaskPrefix(input);
expect(output).toBe(input);
});
});