-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into test-public-user
- Loading branch information
Showing
18 changed files
with
321 additions
and
541 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: check-pull-request-title | ||
|
||
on: | ||
pull_request: | ||
types: [edited, opened] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Validate PR title | ||
run: | | ||
set -e | ||
pr_name="${{ github.event.pull_request.title }}" | ||
echo "PR Title: '${pr_name}'" | ||
# Regex to check following: | ||
# Starts with "VIDCS-" followed by digits | ||
# A colon (:) followed by exactly one space | ||
# followed by the actual PR title text | ||
regex="^VIDCS-[0-9]+: [^ ].*$" | ||
if [[ "$pr_name" =~ $regex ]]; then | ||
echo "Acceptable title" | ||
exit 0 | ||
else | ||
echo "Rejected title" | ||
echo "Reason: The PR title must start with 'VIDCS-' followed by digits, a colon (:), and exactly one space, with the rest of the title immediately after the space." | ||
exit 1 | ||
fi | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ env: | |
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
contents: write | ||
steps: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import isValidRoomName from './isValidRoomName'; | ||
|
||
export default isValidRoomName; |
21 changes: 21 additions & 0 deletions
21
frontend/src/utils/isValidRoomName/isValidRoomName.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { describe, it, expect } from 'vitest'; | ||
import isValidRoomName from './isValidRoomName'; | ||
|
||
describe('isValidRoomName', () => { | ||
const testCases = [ | ||
{ input: 'room_name', expected: true }, | ||
{ input: 'room+name', expected: true }, | ||
{ input: 'another-room_name', expected: true }, | ||
{ input: '123roomname', expected: true }, | ||
{ input: 'room@name', expected: false }, | ||
{ input: 'room#name', expected: false }, | ||
{ input: 'room$name', expected: false }, | ||
]; | ||
|
||
testCases.forEach(({ input, expected }) => { | ||
it(`should return ${expected} for "${input}"`, () => { | ||
const result = isValidRoomName(input); | ||
expect(result).toBe(expected); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const isValidRoomName = (name: string) => { | ||
// Regular expression to allow letters, numbers, underscores, hyphens, and plus sign only | ||
const regex = /^[a-z0-9_+-]+$/; | ||
return regex.test(name); | ||
}; | ||
|
||
export default isValidRoomName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.