@@ -4,112 +4,6 @@ import { Octokit } from "@octokit/core";
44import { enterpriseCompatibility } from "../src" ;
55const OctokitWithPlugin = Octokit . plugin ( enterpriseCompatibility ) ;
66
7- describe ( "{POST|PUT} /repos/{owner}/{repo}/issues/{issue_number}/labels" , ( ) => {
8- it ( "POST sends labels in request body" , ( ) => {
9- const mock = fetchMock
10- . sandbox ( )
11- . post (
12- "https://original.test/repos/octokit/rest.js/issues/1/labels" ,
13- { } ,
14- {
15- // @ts -ignore definitions missing, see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/40133
16- body : {
17- labels : [ "foo" , "bar" ] ,
18- } ,
19- }
20- )
21- . post (
22- "https://patched.test/repos/octokit/rest.js/issues/1/labels" ,
23- { } ,
24- {
25- // @ts -ignore definitions missing, see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/40133
26- body : [ "foo" , "bar" ] ,
27- }
28- ) ;
29-
30- const octokitOriginal = new Octokit ( {
31- baseUrl : "https://original.test" ,
32- request : {
33- fetch : mock ,
34- } ,
35- } ) ;
36- const octokitPatched = new OctokitWithPlugin ( {
37- baseUrl : "https://patched.test" ,
38- request : {
39- fetch : mock ,
40- } ,
41- } ) ;
42-
43- const options = {
44- method : "POST" ,
45- url : "/repos/{owner}/{repo}/issues/{issue_number}/labels" ,
46- owner : "octokit" ,
47- repo : "rest.js" ,
48- issue_number : 1 ,
49- labels : [ "foo" , "bar" ] ,
50- } ;
51-
52- return Promise . all ( [
53- // @ts -ignore no idea why TypeScript is complaining about "POST" not being compatible with RequestMethod, which is an enum including "POST"
54- octokitOriginal . request ( options ) ,
55- // @ts -ignore
56- octokitPatched . request ( options ) ,
57- ] ) ;
58- } ) ;
59-
60- it ( "octokit.issues.setLabels() sends labels in request body" , ( ) => {
61- const mock = fetchMock
62- . sandbox ( )
63- . put (
64- "https://original.test/repos/octokit/rest.js/issues/1/labels" ,
65- { } ,
66- {
67- // @ts -ignore definitions missing, see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/40133
68- body : {
69- labels : [ "foo" , "bar" ] ,
70- } ,
71- }
72- )
73- . put (
74- "https://patched.test/repos/octokit/rest.js/issues/1/labels" ,
75- { } ,
76- {
77- // @ts -ignore definitions missing, see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/40133
78- body : [ "foo" , "bar" ] ,
79- }
80- ) ;
81-
82- const octokitOriginal = new Octokit ( {
83- baseUrl : "https://original.test" ,
84- request : {
85- fetch : mock ,
86- } ,
87- } ) ;
88- const octokitPatched = new OctokitWithPlugin ( {
89- baseUrl : "https://patched.test" ,
90- request : {
91- fetch : mock ,
92- } ,
93- } ) ;
94-
95- const options = {
96- method : "PUT" ,
97- url : "/repos/{owner}/{repo}/issues/{issue_number}/labels" ,
98- owner : "octokit" ,
99- repo : "rest.js" ,
100- issue_number : 1 ,
101- labels : [ "foo" , "bar" ] ,
102- } ;
103-
104- return Promise . all ( [
105- // @ts -ignore no idea why TypeScript is complaining about "POST" not being compatible with RequestMethod, which is an enum including "POST"
106- octokitOriginal . request ( options ) ,
107- // @ts -ignore
108- octokitPatched . request ( options ) ,
109- ] ) ;
110- } ) ;
111- } ) ;
112-
1137describe ( "GET /repos/{owner}/{repo}/issues/{issue_number}/labels" , ( ) => {
1148 it ( "has no effect on GET methods" , async ( ) => {
1159 const mock = fetchMock
0 commit comments