Skip to content

Commit 5b6dbf4

Browse files
committed
Merge branch 'staging' into bugfix/schiltz3/deepsource
2 parents 7df1e41 + 6606b40 commit 5b6dbf4

File tree

4 files changed

+6459
-397
lines changed

4 files changed

+6459
-397
lines changed

__tests__/utils/channels.tests.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,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+
});

jest.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/** @type {import('ts-jest').JestConfigWithTsJest} */
2+
module.exports = {
3+
preset: 'ts-jest',
4+
testEnvironment: 'node',
5+
};

0 commit comments

Comments
 (0)