-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add get-latest-version test (#31)
* refactor: Use core.info() * test: Add getURL() test * test: Add getLatestBrew() and getLatestGithub()
- Loading branch information
Showing
8 changed files
with
202 additions
and
19 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name":"mdbook","full_name":"mdbook","oldname":null,"aliases":[],"versioned_formulae":[],"desc":"Create modern online books from Markdown files","homepage":"https://rust-lang.github.io/mdBook/","versions":{"stable":"0.3.5","devel":null,"head":null,"bottle":true},"revision":0,"version_scheme":0,"bottle":{"stable":{"rebuild":0,"cellar":":any_skip_relocation","prefix":"/usr/local","root_url":"https://homebrew.bintray.com/bottles","files":{"catalina":{"url":"https://homebrew.bintray.com/bottles/mdbook-0.3.5.catalina.bottle.tar.gz","sha256":"0f164851ce201f257d69d4d55e50fa7707cea1ab268a5b239266a4662845beef"},"mojave":{"url":"https://homebrew.bintray.com/bottles/mdbook-0.3.5.mojave.bottle.tar.gz","sha256":"1a2b15f790541dc456294475b42927a152ea614857dfb49ca5f1a00aec1e9509"},"high_sierra":{"url":"https://homebrew.bintray.com/bottles/mdbook-0.3.5.high_sierra.bottle.tar.gz","sha256":"b2305bde8f2f620393c813fc208e9364e0681eff43d6535e7202841fc832ec9c"}}}},"keg_only":false,"bottle_disabled":false,"options":[],"build_dependencies":["rust"],"dependencies":[],"recommended_dependencies":[],"optional_dependencies":[],"uses_from_macos":[],"requirements":[],"conflicts_with":[],"caveats":null,"installed":[],"linked_keg":null,"pinned":false,"outdated":false,"analytics":{"install":{"30d":{"mdbook":62},"90d":{"mdbook":451},"365d":{"mdbook":774}},"install_on_request":{"30d":{"mdbook":62},"90d":{"mdbook":450},"365d":{"mdbook":774}},"build_error":{"30d":{"mdbook":0}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
{ | ||
"url": "https://api.github.com/repos/rust-lang/mdBook/releases/21381829", | ||
"assets_url": "https://api.github.com/repos/rust-lang/mdBook/releases/21381829/assets", | ||
"upload_url": "https://uploads.github.com/repos/rust-lang/mdBook/releases/21381829/assets{?name,label}", | ||
"html_url": "https://github.com/rust-lang/mdBook/releases/tag/v0.3.5", | ||
"id": 21381829, | ||
"node_id": "MDc6UmVsZWFzZTIxMzgxODI5", | ||
"tag_name": "v0.3.5", | ||
"target_commitish": "master", | ||
"name": "v0.3.5", | ||
"draft": false, | ||
"author": { | ||
"login": "ehuss", | ||
"id": 43198, | ||
"node_id": "MDQ6VXNlcjQzMTk4", | ||
"avatar_url": "https://avatars0.githubusercontent.com/u/43198?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/ehuss", | ||
"html_url": "https://github.com/ehuss", | ||
"followers_url": "https://api.github.com/users/ehuss/followers", | ||
"following_url": "https://api.github.com/users/ehuss/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/ehuss/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/ehuss/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/ehuss/subscriptions", | ||
"organizations_url": "https://api.github.com/users/ehuss/orgs", | ||
"repos_url": "https://api.github.com/users/ehuss/repos", | ||
"events_url": "https://api.github.com/users/ehuss/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/ehuss/received_events", | ||
"type": "User", | ||
"site_admin": false | ||
}, | ||
"prerelease": false, | ||
"created_at": "2019-11-11T21:36:13Z", | ||
"published_at": "2019-11-11T21:37:26Z", | ||
"assets": [ | ||
{ | ||
"url": "https://api.github.com/repos/rust-lang/mdBook/releases/assets/16096171", | ||
"id": 16096171, | ||
"node_id": "MDEyOlJlbGVhc2VBc3NldDE2MDk2MTcx", | ||
"name": "mdbook-v0.3.5-x86_64-apple-darwin.tar.gz", | ||
"label": "", | ||
"uploader": { | ||
"login": "github-actions[bot]", | ||
"id": 41898282, | ||
"node_id": "MDM6Qm90NDE4OTgyODI=", | ||
"avatar_url": "https://avatars2.githubusercontent.com/in/15368?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/github-actions%5Bbot%5D", | ||
"html_url": "https://github.com/apps/github-actions", | ||
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers", | ||
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions", | ||
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs", | ||
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos", | ||
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events", | ||
"type": "Bot", | ||
"site_admin": false | ||
}, | ||
"content_type": "application/octet-stream", | ||
"state": "uploaded", | ||
"size": 3409794, | ||
"download_count": 212, | ||
"created_at": "2019-11-11T21:44:16Z", | ||
"updated_at": "2019-11-11T21:44:17Z", | ||
"browser_download_url": "https://github.com/rust-lang/mdBook/releases/download/v0.3.5/mdbook-v0.3.5-x86_64-apple-darwin.tar.gz" | ||
}, | ||
{ | ||
"url": "https://api.github.com/repos/rust-lang/mdBook/releases/assets/16096347", | ||
"id": 16096347, | ||
"node_id": "MDEyOlJlbGVhc2VBc3NldDE2MDk2MzQ3", | ||
"name": "mdbook-v0.3.5-x86_64-pc-windows-msvc.zip", | ||
"label": "", | ||
"uploader": { | ||
"login": "github-actions[bot]", | ||
"id": 41898282, | ||
"node_id": "MDM6Qm90NDE4OTgyODI=", | ||
"avatar_url": "https://avatars2.githubusercontent.com/in/15368?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/github-actions%5Bbot%5D", | ||
"html_url": "https://github.com/apps/github-actions", | ||
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers", | ||
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions", | ||
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs", | ||
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos", | ||
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events", | ||
"type": "Bot", | ||
"site_admin": false | ||
}, | ||
"content_type": "application/octet-stream", | ||
"state": "uploaded", | ||
"size": 3219324, | ||
"download_count": 283, | ||
"created_at": "2019-11-11T21:52:53Z", | ||
"updated_at": "2019-11-11T21:52:53Z", | ||
"browser_download_url": "https://github.com/rust-lang/mdBook/releases/download/v0.3.5/mdbook-v0.3.5-x86_64-pc-windows-msvc.zip" | ||
}, | ||
{ | ||
"url": "https://api.github.com/repos/rust-lang/mdBook/releases/assets/16096247", | ||
"id": 16096247, | ||
"node_id": "MDEyOlJlbGVhc2VBc3NldDE2MDk2MjQ3", | ||
"name": "mdbook-v0.3.5-x86_64-unknown-linux-gnu.tar.gz", | ||
"label": "", | ||
"uploader": { | ||
"login": "github-actions[bot]", | ||
"id": 41898282, | ||
"node_id": "MDM6Qm90NDE4OTgyODI=", | ||
"avatar_url": "https://avatars2.githubusercontent.com/in/15368?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/github-actions%5Bbot%5D", | ||
"html_url": "https://github.com/apps/github-actions", | ||
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers", | ||
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions", | ||
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs", | ||
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos", | ||
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events", | ||
"type": "Bot", | ||
"site_admin": false | ||
}, | ||
"content_type": "application/octet-stream", | ||
"state": "uploaded", | ||
"size": 3937087, | ||
"download_count": 2131, | ||
"created_at": "2019-11-11T21:48:20Z", | ||
"updated_at": "2019-11-11T21:48:21Z", | ||
"browser_download_url": "https://github.com/rust-lang/mdBook/releases/download/v0.3.5/mdbook-v0.3.5-x86_64-unknown-linux-gnu.tar.gz" | ||
} | ||
], | ||
"tarball_url": "https://api.github.com/repos/rust-lang/mdBook/tarball/v0.3.5", | ||
"zipball_url": "https://api.github.com/repos/rust-lang/mdBook/zipball/v0.3.5", | ||
"body": "See https://github.com/rust-lang-nursery/mdBook/blob/master/CHANGELOG.md#mdbook-035 for a complete list of changes." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import * as target from '../src/get-latest-version'; | ||
import jsonTestBrew from './data/brew.json'; | ||
import jsonTestGithub from './data/github.json'; | ||
|
||
describe('Test', () => { | ||
test('getURL()', () => { | ||
const org: string = 'rust-lang'; | ||
const repo: string = 'mdbook'; | ||
const urlBrewExpected: string = `https://formulae.brew.sh/api/formula/${repo}.json`; | ||
const urlGithubExpected: string = `https://api.github.com/repos/${org}/${repo}/releases/latest`; | ||
const urlBrew: string = target.getURL(org, repo, 'brew'); | ||
const urlGithub: string = target.getURL(org, repo, 'github'); | ||
|
||
expect(urlBrew).toMatch(urlBrewExpected); | ||
expect(urlGithub).toMatch(urlGithubExpected); | ||
}); | ||
|
||
let versionLatest: string = '0.3.5'; | ||
|
||
test('getLatestBrew()', () => { | ||
const jsonBrew: target.JsonBrew = jsonTestBrew; | ||
const versionBrew: string = target.getLatestBrew(jsonBrew); | ||
expect(versionBrew).toMatch(versionLatest); | ||
}); | ||
|
||
test('getLatestGithub()', () => { | ||
const jsonGithub: target.JsonGithub = jsonTestGithub; | ||
const versionGithub: string = target.getLatestGithub(jsonGithub); | ||
expect(versionGithub).toMatch(versionLatest); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters