@@ -3,9 +3,9 @@ import path from 'path';
3
3
import { testEnv , getContext , testFs } from '@technote-space/github-action-test-helper' ;
4
4
import { Utils } from '../src' ;
5
5
6
- const { getWorkspace, getActor, escapeRegExp, getRegExp, getPrefixRegExp, getSuffixRegExp, useNpm, versionCompare} = Utils ;
7
- const { isSemanticVersioningTagName, isPrRef, getPrMergeRef, getBoolValue, replaceAll, getPrHeadRef, arrayChunk} = Utils ;
8
- const { getBranch, getRefForUpdate, uniqueArray, getBuildInfo, split, getArrayInput, generateNewPatchVersion, sleep } = Utils ;
6
+ const { getWorkspace, getActor, escapeRegExp, getRegExp, getPrefixRegExp, getSuffixRegExp, useNpm, versionCompare} = Utils ;
7
+ const { isSemanticVersioningTagName, isPrRef, getPrMergeRef, getBoolValue, replaceAll, getPrHeadRef, arrayChunk, sleep } = Utils ;
8
+ const { getBranch, getRefForUpdate, uniqueArray, getBuildInfo, split, getArrayInput, generateNewPatchVersion, getPrBranch } = Utils ;
9
9
10
10
jest . useFakeTimers ( ) ;
11
11
@@ -219,6 +219,24 @@ describe('getBranch', () => {
219
219
} ) ;
220
220
} ) ;
221
221
222
+ describe ( 'getPrBranch' , ( ) => {
223
+ it ( 'should get pr branch' , ( ) => {
224
+ expect ( getPrBranch ( getContext ( {
225
+ payload : {
226
+ 'pull_request' : {
227
+ head : {
228
+ ref : 'test/abc' ,
229
+ } ,
230
+ } ,
231
+ } ,
232
+ } ) ) ) . toBe ( 'test/abc' ) ;
233
+ } ) ;
234
+
235
+ it ( 'should not get pr branch' , ( ) => {
236
+ expect ( getPrBranch ( getContext ( { } ) ) ) . toBe ( '' ) ;
237
+ } ) ;
238
+ } ) ;
239
+
222
240
describe ( 'getRefForUpdate' , ( ) => {
223
241
// https://github.com/octokit/rest.js/issues/1308#issuecomment-480532468
224
242
it ( 'should get ref for update' , ( ) => {
0 commit comments