|
1 | | -import { cleanChannelString } from "../../utils/channels"; |
2 | | -import { test, expect, describe, it } from "@jest/globals"; |
3 | | - |
4 | | -//cleanChannelString |
5 | | - |
6 | | -describe("cleanChannelString", () => { |
7 | | - it("should lowercase the string", () => { |
8 | | - expect(cleanChannelString("ABCD")).toEqual("abcd"); |
9 | | - }); |
10 | | - |
11 | | - it("should remove special characters", () => { |
12 | | - expect(cleanChannelString("a!b@c#d$")).toEqual("abcd"); |
13 | | - }); |
14 | | - |
15 | | - it('should replace "compsci " with "cs"', () => { |
16 | | - expect(cleanChannelString("compsci")).toEqual("cs"); |
17 | | - }); |
18 | | - |
19 | | - it("should replace spaces and parentheses with hyphens", () => { |
20 | | - expect(cleanChannelString("a b (c)")).toEqual("a-b-c"); |
21 | | - }); |
22 | | - it("should return an empty string for an empty input", () => { |
23 | | - expect(cleanChannelString("")).toBe(""); |
24 | | - }); |
25 | | - |
26 | | - it("cleanChannelString should return an empty string for a string with only special characters", () => { |
27 | | - expect(cleanChannelString("!@#$%^&*")).toBe(""); |
28 | | - }); |
29 | | - |
30 | | - it("should handle a mix of all transformations", () => { |
31 | | - expect(cleanChannelString("Compsci 123!")).toEqual("cs-123"); |
32 | | - }); |
33 | | -}); |
| 1 | +import { cleanChannelString } from "../../utils/channels"; |
| 2 | +import { test, expect, describe, it } from "@jest/globals"; |
| 3 | + |
| 4 | +//cleanChannelString |
| 5 | + |
| 6 | +describe("cleanChannelString", () => { |
| 7 | + it("should lowercase the string", () => { |
| 8 | + expect(cleanChannelString("ABCD")).toEqual("abcd"); |
| 9 | + }); |
| 10 | + |
| 11 | + it("should remove special characters", () => { |
| 12 | + expect(cleanChannelString("a!b@c#d$")).toEqual("abcd"); |
| 13 | + }); |
| 14 | + |
| 15 | + it('should replace "compsci " with "cs"', () => { |
| 16 | + expect(cleanChannelString("compsci")).toEqual("cs"); |
| 17 | + }); |
| 18 | + |
| 19 | + it("should replace spaces and parentheses with hyphens", () => { |
| 20 | + expect(cleanChannelString("a b (c)")).toEqual("a-b-c"); |
| 21 | + }); |
| 22 | + it("should return an empty string for an empty input", () => { |
| 23 | + expect(cleanChannelString("")).toBe(""); |
| 24 | + }); |
| 25 | + |
| 26 | + it("cleanChannelString should return an empty string for a string with only special characters", () => { |
| 27 | + expect(cleanChannelString("!@#$%^&*")).toBe(""); |
| 28 | + }); |
| 29 | + |
| 30 | + it("should handle a mix of all transformations", () => { |
| 31 | + expect(cleanChannelString("Compsci 123!")).toEqual("cs-123"); |
| 32 | + }); |
| 33 | +}); |
0 commit comments