Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove obsolete [CratesSize] test for null size #10688

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions services/crates/crates-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { BaseJsonService, InvalidResponse } from '../index.js'

const versionSchema = Joi.object({
downloads: nonNegativeInteger,
// Crate size is not available for all versions.
crate_size: nonNegativeInteger.allow(null),
crate_size: nonNegativeInteger,
num: Joi.string().required(),
license: Joi.string().required().allow(null),
rust_version: Joi.string().allow(null),
Expand Down
7 changes: 1 addition & 6 deletions services/crates/crates-size.service.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import prettyBytes from 'pretty-bytes'
import { InvalidResponse, pathParams } from '../index.js'
import { pathParams } from '../index.js'
import { BaseCratesService, description } from './crates-base.js'

export default class CratesSize extends BaseCratesService {
Expand Down Expand Up @@ -49,11 +49,6 @@ export default class CratesSize extends BaseCratesService {
async handle({ crate, version }) {
const json = await this.fetch({ crate, version })
const size = this.constructor.getVersionObj(json).crate_size

if (size == null) {
throw new InvalidResponse({ prettyMessage: 'unknown' })
}

return this.render({ size })
}
}
4 changes: 0 additions & 4 deletions services/crates/crates-size.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ t.create('size (with version)')
.get('/tokio/1.32.0.json')
.expectBadge({ label: 'size', message: '725 kB' })

t.create('size (with version where version doesnt have size)')
.get('/tokio/0.1.6.json')
.expectBadge({ label: 'crates.io', message: 'unknown' })

t.create('size (not found)')
.get('/not-a-crate.json')
.expectBadge({ label: 'crates.io', message: 'not found' })
Loading