File tree Expand file tree Collapse file tree 3 files changed +50
-1
lines changed
packages/commitlint-wizardoc-e2e-tests/src/tests Expand file tree Collapse file tree 3 files changed +50
-1
lines changed Original file line number Diff line number Diff line change 1+ if [[ $1 =~ ^([a-z]+)/[a-z]+ (-[a-z]+)+$ ]]; then
2+ if [[ ${BASH_REMATCH[1]} =~ ^(feature| fix)$ ]]; then
3+ echo " success"
4+ exit 0
5+ else
6+ echo " error"
7+ exit 1
8+ fi
9+ else
10+ echo " erroe"
11+ exit 1
12+ fi
Original file line number Diff line number Diff line change 99 - uses : actions/checkout@v2
1010
1111 - name : check branch name
12- run : echo " ${GITHUB_REF#refs/heads/}" |grep -q "feature/" && exit 0 || exit 1
12+ run : ./.github/shell/branchName.sh ${GITHUB_REF#refs/heads/}
Original file line number Diff line number Diff line change 1+ /* eslint-disable import/no-extraneous-dependencies */
2+ import { $ } from "../utils/shell" ;
3+
4+ const SUCCESS_SIGNAL = 0 ;
5+ const ERROR_SIGNAL = 1 ;
6+
7+ describe ( "branchNameTest" , ( ) => {
8+ it ( "success branch name" , ( ) => {
9+ const res = $ `sh ./.github/shell/branchName.sh feature/git-rebase-test` ;
10+
11+ expect ( res . code ) . toEqual ( SUCCESS_SIGNAL ) ;
12+ } ) ;
13+
14+ it ( "type error" , ( ) => {
15+ const res = $ `sh ./.github/shell/branchName.sh test/git-rebase-test` ;
16+
17+ expect ( res . code ) . toEqual ( ERROR_SIGNAL ) ;
18+ } ) ;
19+
20+ it ( "empty branch name error" , ( ) => {
21+ const res = $ `sh ./.github/shell/branchName.sh feature/` ;
22+
23+ expect ( res . code ) . toEqual ( ERROR_SIGNAL ) ;
24+ } ) ;
25+
26+ it ( "separator branch name error" , ( ) => {
27+ const res = $ `sh ./.github/shell/branchName.sh feature/brach_name` ;
28+
29+ expect ( res . code ) . toEqual ( ERROR_SIGNAL ) ;
30+ } ) ;
31+
32+ it ( "upper Case branch name error" , ( ) => {
33+ const res = $ `sh ./.github/shell/branchName.sh feature/brachName` ;
34+
35+ expect ( res . code ) . toEqual ( ERROR_SIGNAL ) ;
36+ } ) ;
37+ } ) ;
You can’t perform that action at this time.
0 commit comments