forked from badges/shields
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Crates] Only use non-yanked crate versions (ready for merge) (badges…
…#9949) * prototype fix msrv using yanked versions * make it prettier * deduplicate schema definition and add version info helper function * use newest version only if it wasnt yanked * fix variable name typo * remove unused import * try add new test * satisfy linter * don't import "describe()" * fixup --------- Co-authored-by: chris48s <[email protected]>
- Loading branch information
1 parent
39ec093
commit e36d933
Showing
9 changed files
with
106 additions
and
55 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
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,47 @@ | ||
import { expect } from 'chai' | ||
import { test, given } from 'sazerac' | ||
import { BaseCratesService } from './crates-base.js' | ||
|
||
describe('BaseCratesService', function () { | ||
describe('getLatestVersion', function () { | ||
test(BaseCratesService.getLatestVersion, () => { | ||
given({ crate: { max_version: '1.1.0' } }).expect('1.1.0') | ||
given({ | ||
crate: { max_stable_version: '1.1.0', max_version: '1.9.0-alpha' }, | ||
}).expect('1.1.0') | ||
}) | ||
}) | ||
|
||
describe('getVersionObj', function () { | ||
const versions = [ | ||
/* | ||
These versions are more recent, but we're going to ignore them | ||
That might be because they were yanked, or because they're pre-releases. | ||
*/ | ||
{ num: '1.3.0-beta' }, | ||
{ num: '1.2.0' }, | ||
// this is the one we will select | ||
{ num: '1.1.0' }, | ||
] | ||
|
||
it('ignores more recent versions than max_stable_version', function () { | ||
const response = { | ||
crate: { | ||
max_stable_version: '1.1.0', | ||
}, | ||
versions, | ||
} | ||
expect(BaseCratesService.getVersionObj(response).num).to.equal('1.1.0') | ||
}) | ||
|
||
it('ignores more recent versions than max_version', function () { | ||
const response = { | ||
crate: { | ||
max_version: '1.1.0', | ||
}, | ||
versions, | ||
} | ||
expect(BaseCratesService.getVersionObj(response).num).to.equal('1.1.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
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 was deleted.
Oops, something went wrong.