-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #151 from Cyberbeni/more-unit-tests
Add more unit tests, add recommended stylistic formatting options
- Loading branch information
Showing
10 changed files
with
98 additions
and
29 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
name: "PR checks" | ||
|
||
on: pull_request | ||
on: | ||
pull_request: | ||
push: | ||
branches: master | ||
|
||
jobs: | ||
npm-pr-checks: | ||
|
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,44 @@ | ||
import { SwiftToolInstaller } from '../src/installer' | ||
|
||
describe('Version resolving', () => { | ||
test.each([ | ||
'2', | ||
'2.4', | ||
'2.4.1', | ||
'<3', | ||
'v2', | ||
'^2', | ||
'~2', | ||
'^2.3', | ||
'~2.4', | ||
'~2.4.0', | ||
'2.x', | ||
])('%s', async (version) => { | ||
const installer = new SwiftToolInstaller('https://github.com/Cyberbeni/install-swift-tool', '', '', version, false) | ||
await installer.resolveVersion() | ||
expect(installer.branch).toBe('v2.4.1') | ||
}) | ||
}) | ||
|
||
describe('Package.resolved v3 parsing', () => { | ||
test('success', async () => { | ||
const installer = new SwiftToolInstaller('https://github.com/nicklockwood/SwiftFormat', '', '', '', false) | ||
const hash = await installer.getCommitHash() | ||
expect(hash).toBe('ab6844edb79a7b88dc6320e6cee0a0db7674dac3') | ||
}) | ||
test('error if not found', async () => { | ||
const installer = new SwiftToolInstaller('https://github.com/cpisciotta/xcbeautify', '', '', '', false) | ||
await expect(installer.getCommitHash()).rejects.toThrow() | ||
}) | ||
}) | ||
|
||
describe('Branch/tag resolving', () => { | ||
test.each([ | ||
'v2', // branch | ||
'v2.4.1', // tag | ||
])('%s', async (branch) => { | ||
const installer = new SwiftToolInstaller('https://github.com/Cyberbeni/install-swift-tool', '', branch, '', false) | ||
const hash = await installer.getCommitHash() | ||
expect(hash).toBe('7c869f37ca4184c71b60034c7d81e33e1e35d051') | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -835,6 +835,17 @@ | |
dependencies: | ||
"@sinonjs/commons" "^3.0.0" | ||
|
||
"@stylistic/eslint-plugin@^2.9.0": | ||
version "2.9.0" | ||
resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin/-/eslint-plugin-2.9.0.tgz#5ab3326303915e020ddaf39154290e2800a84bcd" | ||
integrity sha512-OrDyFAYjBT61122MIY1a3SfEgy3YCMgt2vL4eoPmvTwDBwyQhAXurxNQznlRD/jESNfYWfID8Ej+31LljvF7Xg== | ||
dependencies: | ||
"@typescript-eslint/utils" "^8.8.0" | ||
eslint-visitor-keys "^4.1.0" | ||
espree "^10.2.0" | ||
estraverse "^5.3.0" | ||
picomatch "^4.0.2" | ||
|
||
"@tsconfig/node20@^20.1.4": | ||
version "20.1.4" | ||
resolved "https://registry.yarnpkg.com/@tsconfig/node20/-/node20-20.1.4.tgz#3457d42eddf12d3bde3976186ab0cd22b85df928" | ||
|
@@ -1014,7 +1025,7 @@ | |
semver "^7.6.0" | ||
ts-api-utils "^1.3.0" | ||
|
||
"@typescript-eslint/[email protected]": | ||
"@typescript-eslint/[email protected]", "@typescript-eslint/utils@^8.8.0": | ||
version "8.9.0" | ||
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.9.0.tgz#748bbe3ea5bee526d9786d9405cf1b0df081c299" | ||
integrity sha512-PKgMmaSo/Yg/F7kIZvrgrWa1+Vwn036CdNUvYFEkYbPwOH4i8xvkaRlu148W3vtheWK9ckKRIz7PBP5oUlkrvQ== | ||
|
@@ -1532,7 +1543,7 @@ eslint@^9.11.1: | |
strip-ansi "^6.0.1" | ||
text-table "^0.2.0" | ||
|
||
espree@^10.0.1, espree@^10.1.0: | ||
espree@^10.0.1, espree@^10.1.0, espree@^10.2.0: | ||
version "10.2.0" | ||
resolved "https://registry.yarnpkg.com/espree/-/espree-10.2.0.tgz#f4bcead9e05b0615c968e85f83816bc386a45df6" | ||
integrity sha512-upbkBJbckcCNBDBDXEbuhjbP68n+scUd3k/U2EkyM9nw+I/jPiL4cLF/Al06CF96wRltFda16sxDFrxsI1v0/g== | ||
|
@@ -1560,7 +1571,7 @@ esrecurse@^4.3.0: | |
dependencies: | ||
estraverse "^5.2.0" | ||
|
||
estraverse@^5.1.0, estraverse@^5.2.0: | ||
estraverse@^5.1.0, estraverse@^5.2.0, estraverse@^5.3.0: | ||
version "5.3.0" | ||
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" | ||
integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== | ||
|
@@ -2691,6 +2702,11 @@ picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: | |
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" | ||
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== | ||
|
||
picomatch@^4.0.2: | ||
version "4.0.2" | ||
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.2.tgz#77c742931e8f3b8820946c76cd0c1f13730d1dab" | ||
integrity sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg== | ||
|
||
pirates@^4.0.4: | ||
version "4.0.6" | ||
resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.6.tgz#3018ae32ecfcff6c29ba2267cbf21166ac1f36b9" | ||
|