Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Commit

Permalink
test(repo): add e2e for repo search
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Garant committed Oct 11, 2019
1 parent 3185ab5 commit 9edf46a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
10 changes: 10 additions & 0 deletions __tests__/__snapshots__/repo.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,13 @@ duplicate
enhancement
"
`;

exports[`E2E: Repo Module Test Search repositories from GitHub org showing detailed results. \`gh re --detailed --search octocat org:github\` 1`] = `
"Searching for repos using the criteria: octocat org:github
github/octocatalog-diff
https://github.com/github/octocatalog-diff
Compile Puppet catalogs from 2 branches, versions, etc., and compare them
https://rubygems.org/gems/octocatalog-diff/
last update in 4 years
"
`;
1 change: 1 addition & 0 deletions __tests__/nockFixtures/RepoSearch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"scope":"https://api.github.com:443","method":"GET","path":"/search/repositories?q=octocat%20org%3Agithub&per_page=30","body":"","status":200,"response":{"type":"Buffer","data":[31,139,8,0,0,0,0,0,0,19,173,152,95,139,227,54,16,192,191,138,241,107,115,145,147,219,236,129,161,92,161,79,133,150,150,114,79,45,37,200,246,216,86,87,150,140,36,103,155,53,249,238,29,201,178,99,167,219,252,65,187,132,77,36,107,126,26,143,70,163,25,245,177,145,134,242,125,46,59,97,226,244,105,187,138,153,200,101,211,114,48,176,87,160,59,110,116,156,150,148,107,192,71,6,26,108,253,217,199,172,136,211,77,146,36,171,88,200,2,246,190,185,193,38,109,32,78,99,153,27,153,83,36,203,234,83,193,202,50,94,197,101,199,249,222,63,174,152,169,187,140,188,51,170,85,236,64,13,76,83,202,87,1,42,78,251,24,199,48,49,137,226,72,63,231,118,169,194,231,85,76,17,64,213,190,83,28,135,215,198,180,58,37,100,232,212,155,245,32,223,105,80,185,20,6,132,89,227,235,146,142,36,254,111,243,245,240,253,19,226,43,229,57,22,28,99,199,5,175,101,30,53,200,35,79,147,73,183,218,52,252,66,129,217,224,105,88,41,57,151,175,40,121,169,236,255,195,201,36,51,201,51,81,61,44,143,50,61,145,166,6,180,19,62,61,217,23,102,218,60,162,136,27,223,187,47,180,145,37,104,52,151,130,226,1,134,151,64,85,236,50,159,122,162,160,149,14,213,101,58,87,172,53,76,138,71,148,90,200,33,71,170,138,10,246,70,31,229,160,156,21,183,234,60,34,230,198,163,28,28,208,177,30,17,28,4,122,226,220,63,63,158,220,220,57,176,3,154,243,97,216,133,36,178,204,177,181,219,238,215,153,53,172,145,113,63,239,105,209,216,125,229,182,219,233,62,207,125,111,223,22,48,217,29,69,127,196,8,194,56,68,191,117,109,11,38,242,99,117,84,42,217,68,219,40,83,84,228,53,232,85,116,64,181,237,210,172,34,48,249,122,21,81,81,68,54,252,80,5,17,122,103,227,156,92,189,76,225,224,170,17,156,245,175,232,104,73,55,236,120,21,65,28,0,65,47,112,12,226,88,249,222,254,247,27,39,199,61,73,51,169,168,145,183,98,193,117,240,2,212,47,154,118,30,3,180,9,226,59,128,141,111,82,134,89,210,1,108,16,215,186,131,187,60,252,58,207,113,244,180,141,68,215,100,67,84,11,71,79,155,136,106,205,42,1,16,68,155,32,61,25,3,239,184,27,66,176,35,163,247,191,220,106,211,42,108,177,169,139,129,25,151,89,16,7,251,137,131,244,68,215,116,56,106,204,62,84,59,75,181,140,5,84,65,25,12,181,140,9,106,84,224,122,59,53,149,91,111,143,196,51,207,224,210,7,81,71,6,233,61,148,83,81,117,180,10,163,78,16,127,150,87,244,237,102,110,114,83,79,79,113,81,78,24,197,178,46,60,200,157,57,231,84,33,11,85,245,140,185,200,63,62,128,218,250,19,23,5,26,22,22,142,60,98,225,246,31,128,181,126,122,137,182,237,208,232,57,50,230,49,121,8,250,254,201,7,68,253,247,230,240,201,125,176,163,89,6,233,191,107,169,169,189,73,108,110,18,104,17,139,32,125,70,49,227,90,175,215,125,13,212,165,1,13,168,192,29,60,16,236,89,165,242,26,83,192,16,86,63,50,48,235,105,168,113,201,121,105,213,44,48,89,231,146,22,65,154,78,144,209,31,62,224,248,159,175,127,139,213,102,16,210,1,230,196,6,19,90,109,164,8,92,161,137,50,103,11,105,88,201,242,123,202,148,235,248,5,168,255,170,177,152,135,21,229,124,133,46,103,88,206,208,143,177,244,27,78,140,12,194,44,52,16,240,53,176,166,31,10,22,14,52,240,96,27,25,61,25,50,227,2,90,46,143,193,81,104,134,177,155,88,1,53,88,30,81,131,188,109,178,249,242,105,147,224,231,219,230,57,77,18,252,252,97,171,253,182,184,57,166,237,116,125,99,136,141,206,131,222,248,235,174,90,202,190,148,61,128,116,125,22,252,225,44,150,94,23,203,57,186,214,195,245,219,56,231,225,242,172,187,171,244,171,101,3,45,166,13,51,57,213,101,199,10,26,189,198,58,154,216,31,255,93,18,87,127,190,161,208,110,151,124,254,178,72,56,102,151,81,175,212,96,90,187,236,27,211,20,156,239,119,156,199,106,64,245,126,8,1,113,106,84,7,67,79,171,228,223,144,155,69,223,57,236,204,58,95,217,11,155,42,76,39,233,146,160,177,103,40,27,103,10,52,76,41,233,47,152,4,134,137,41,220,22,147,76,193,52,205,248,172,67,182,32,188,142,139,119,97,57,8,13,246,130,11,203,65,124,163,198,173,132,191,38,251,229,167,111,209,207,126,4,90,168,45,254,25,175,185,158,110,148,194,158,171,137,231,205,110,200,118,39,255,74,113,250,188,93,40,22,167,219,231,179,201,177,149,60,219,29,88,210,142,155,253,80,87,88,13,169,54,160,172,251,131,106,80,208,221,180,160,254,243,139,132,97,111,204,26,156,15,6,199,185,117,46,21,56,77,214,219,221,110,179,57,253,117,250,23,158,199,22,112,134,20,0,0]},"rawHeaders":["Date","Fri, 11 Oct 2019 20:35:32 GMT","Content-Type","application/json; charset=utf-8","Transfer-Encoding","chunked","Connection","close","Server","GitHub.com","Status","200 OK","X-RateLimit-Limit","30","X-RateLimit-Remaining","27","X-RateLimit-Reset","1570826192","Cache-Control","no-cache","X-OAuth-Scopes","user, public_repo, repo, repo:status, delete_repo, gist","X-Accepted-OAuth-Scopes","","X-GitHub-Media-Type","github.v3; format=json","Access-Control-Expose-Headers","ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type","Access-Control-Allow-Origin","*","Strict-Transport-Security","max-age=31536000; includeSubdomains; preload","X-Frame-Options","deny","X-Content-Type-Options","nosniff","X-XSS-Protection","1; mode=block","Referrer-Policy","origin-when-cross-origin, strict-origin-when-cross-origin","Content-Security-Policy","default-src 'none'","Content-Encoding","gzip","Vary","Accept-Encoding","X-GitHub-Request-Id","FC97:772D:8D56FF:A8F9FF:5DA0E794"]}]
5 changes: 5 additions & 0 deletions __tests__/repo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ describe('E2E: Repo Module Test', () => {
done()
})

it('Search repositories from GitHub org showing detailed results. `gh re --detailed --search octocat org:github`', done => {
expect(runCmd('gh re --detailed --search octocat org:github')).toMatchSnapshot()
done()
})

it('Create new repo `gh re --new foo --init`', done => {
expect(runCmd('gh re --new foo --init')).toMatchSnapshot()
done()
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function prepareTestFixtures(cmdName, argv) {
},
{
name: 'Repo',
flags: ['--label', '--list', '--new', '--fork', '--delete'],
flags: ['--label', '--list', '--new', '--fork', '--delete', '--search'],
},
{
name: 'User',
Expand Down

0 comments on commit 9edf46a

Please sign in to comment.