@@ -5,7 +5,7 @@ const nock = require("nock");
55nock . disableNetConnect ( ) ;
66const octokit = new Octokit ( ) ;
77
8- function run ( body ) {
8+ function run ( body : any ) {
99 return plugin ( octokit , body ) ;
1010}
1111
@@ -345,7 +345,7 @@ test(`success (createBranch, use default base branch)`, async () => {
345345} ) ;
346346
347347test ( `success (createBranch, use default base branch, multiple commits)` , async ( ) => {
348- const body = {
348+ const body : any = {
349349 ...validRequest ,
350350 createBranch : true ,
351351 } ;
@@ -510,7 +510,7 @@ test("Does not overwrite other methods", () => {
510510 expect ( testOctokit ) . toHaveProperty ( "rest.repos.acceptInvitation" ) ;
511511} ) ;
512512
513- function mockGetRef ( branch , sha , success ) {
513+ function mockGetRef ( branch : string , sha : string , success : boolean ) {
514514 const m = nock ( "https://api.github.com" ) . get (
515515 `/repos/${ owner } /${ repo } /git/ref/heads%2F${ branch } ` ,
516516 ) ;
@@ -528,7 +528,7 @@ function mockGetRef(branch, sha, success) {
528528 }
529529}
530530
531- function mockCreateBlob ( content , sha ) {
531+ function mockCreateBlob ( content : string , sha : string ) {
532532 const expectedBody = { content : content , encoding : "base64" } ;
533533 const m = nock ( "https://api.github.com" ) . post (
534534 `/repos/${ owner } /${ repo } /git/blobs` ,
@@ -575,7 +575,7 @@ function mockCreateBlobBase64PreEncoded() {
575575 ) ;
576576}
577577
578- function mockCreateTreeSubmodule ( baseTree ) {
578+ function mockCreateTreeSubmodule ( baseTree : string ) {
579579 const expectedBody = {
580580 tree : [
581581 {
@@ -600,7 +600,7 @@ function mockCreateTreeSubmodule(baseTree) {
600600 m . reply ( 200 , body ) ;
601601}
602602
603- function mockCreateTree ( baseTree ) {
603+ function mockCreateTree ( baseTree : string ) {
604604 const expectedBody = {
605605 tree : [
606606 {
@@ -631,7 +631,7 @@ function mockCreateTree(baseTree) {
631631 m . reply ( 200 , body ) ;
632632}
633633
634- function mockCreateTreeSecond ( baseTree ) {
634+ function mockCreateTreeSecond ( baseTree : string ) {
635635 const expectedBody = {
636636 tree : [
637637 {
@@ -656,7 +656,7 @@ function mockCreateTreeSecond(baseTree) {
656656 m . reply ( 200 , body ) ;
657657}
658658
659- function mockCreateTreeWithIgnoredDelete ( baseTree ) {
659+ function mockCreateTreeWithIgnoredDelete ( baseTree : string ) {
660660 const expectedBody = {
661661 tree : [
662662 {
@@ -681,7 +681,7 @@ function mockCreateTreeWithIgnoredDelete(baseTree) {
681681 m . reply ( 200 , body ) ;
682682}
683683
684- function mockCreateTreeWithDeleteOnly ( baseTree ) {
684+ function mockCreateTreeWithDeleteOnly ( baseTree : string ) {
685685 // The order here is important. Removals must be applied before creations
686686 const expectedBody = {
687687 tree : [
@@ -707,7 +707,7 @@ function mockCreateTreeWithDeleteOnly(baseTree) {
707707 m . reply ( 200 , body ) ;
708708}
709709
710- function mockCreateTreeWithDelete ( baseTree ) {
710+ function mockCreateTreeWithDelete ( baseTree : string ) {
711711 // The order here is important. Removals must be applied before creations
712712 const expectedBody = {
713713 tree : [
@@ -739,7 +739,7 @@ function mockCreateTreeWithDelete(baseTree) {
739739 m . reply ( 200 , body ) ;
740740}
741741
742- function mockCommitSubmodule ( baseTree ) {
742+ function mockCommitSubmodule ( baseTree : string ) {
743743 const expectedBody = {
744744 message : "Your submodule commit message" ,
745745 tree : "4112258c05f8ce2b0570f1bbb1a330c0f9595ff9" ,
@@ -758,7 +758,7 @@ function mockCommitSubmodule(baseTree) {
758758 m . reply ( 200 , body ) ;
759759}
760760
761- function mockCommit ( baseTree , additional ) {
761+ function mockCommit ( baseTree : string , additional ?: any ) {
762762 additional = additional || { } ;
763763
764764 const expectedBody = {
@@ -780,7 +780,7 @@ function mockCommit(baseTree, additional) {
780780 m . reply ( 200 , body ) ;
781781}
782782
783- function mockCommitSecond ( baseTree ) {
783+ function mockCommitSecond ( baseTree : string ) {
784784 const expectedBody = {
785785 message : "This is the second commit" ,
786786 tree : "fffff6bbf5ab983d31b1cca28e204b71ab722764" ,
@@ -799,7 +799,7 @@ function mockCommitSecond(baseTree) {
799799 m . reply ( 200 , body ) ;
800800}
801801
802- function mockUpdateRef ( branch ) {
802+ function mockUpdateRef ( branch : string ) {
803803 const expectedBody = {
804804 force : true ,
805805 sha : "ef105a72c03ce2743d90944c2977b1b5563b43c0" ,
@@ -813,7 +813,7 @@ function mockUpdateRef(branch) {
813813 m . reply ( 200 ) ;
814814}
815815
816- function mockCreateRef ( branch , sha ) {
816+ function mockCreateRef ( branch : string , sha ?: string ) {
817817 const expectedBody = {
818818 force : true ,
819819 ref : `refs/heads/${ branch } ` ,
@@ -828,7 +828,7 @@ function mockCreateRef(branch, sha) {
828828 m . reply ( 200 ) ;
829829}
830830
831- function mockCreateRefSecond ( branch , sha ) {
831+ function mockCreateRefSecond ( branch : string , sha ?: string ) {
832832 const expectedBody = {
833833 force : true ,
834834 ref : `refs/heads/${ branch } ` ,
@@ -843,17 +843,17 @@ function mockCreateRefSecond(branch, sha) {
843843 m . reply ( 200 ) ;
844844}
845845
846- function mockGetRepo ( ) {
846+ function mockGetRepo ( defaultBranch ?: string ) {
847847 const body = {
848- default_branch : "master" ,
848+ default_branch : defaultBranch || "master" ,
849849 } ;
850850
851851 nock ( "https://api.github.com" )
852852 . get ( `/repos/${ owner } /${ repo } ` )
853853 . reply ( 200 , body ) ;
854854}
855855
856- function mockGetContents ( fileName , branch , success ) {
856+ function mockGetContents ( fileName : string , branch : string , success : boolean ) {
857857 const m = nock ( "https://api.github.com" ) . head (
858858 `/repos/${ owner } /${ repo } /contents/${ fileName } ?ref=${ branch } ` ,
859859 ) ;
0 commit comments