11var CopyGitHubLabels = require ( '../' ) ;
2+ var GitHubApi = require ( "@octokit/rest" ) ;
23var chai = require ( 'chai' ) ;
34var expect = chai . expect ;
5+ const githubOptions = {
6+ timeout : 5000 ,
7+ headers : {
8+ accept : 'application/vnd.github.v3+json' ,
9+ 'user-agent' : 'Copy-GitHub-Labels'
10+ } ,
11+ baseUrl : 'https://api.github.com'
12+ } ;
413
514describe ( 'CopyGitHubLabels' , function ( ) {
615
@@ -34,3 +43,34 @@ describe('copyGitHubLabels', function(){
3443
3544 } ) ;
3645} ) ;
46+
47+ describe ( 'GithubAPI' , function ( ) {
48+ it ( 'should be an function' , function ( ) {
49+ expect ( GitHubApi ) . to . be . a ( 'function' ) ;
50+ } ) ;
51+
52+ it ( 'should be an object' , function ( ) {
53+ const octokit = GitHubApi ( githubOptions ) ;
54+ expect ( octokit ) . to . be . a ( 'object' ) ;
55+ } ) ;
56+
57+ it ( 'should be a function' , function ( ) {
58+ const octokit = GitHubApi ( githubOptions ) ;
59+ expect ( octokit . issues . getLabels ) . to . be . a ( 'function' ) ;
60+ } ) ;
61+
62+ it ( 'should be an array' , function ( done ) {
63+ const testRepo = {
64+ owner : 'Incrementis' ,
65+ repo : 'TEST-REPO' ,
66+ page : 1
67+ } ;
68+ const octokit = GitHubApi ( githubOptions ) ;
69+ octokit . issues . getLabels ( testRepo , function ( error , labels ) {
70+ expect ( labels ) . to . be . a ( 'object' ) ;
71+ expect ( labels . data ) . to . be . a ( 'Array' ) ;
72+ expect ( labels . data . length ) . to . be . at . least ( 1 ) ;
73+ done ( ) ;
74+ } ) ;
75+ } ) ;
76+ } ) ;
0 commit comments