* chore(deps-dev): bump prettier from 2.8.8 to 3.0.0 Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.0.0) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * reformat all the things (prettier 3) * update tests to await calls to prettier.format() --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: chris48s <git@chris-shaw.dev>
102 lines
2.3 KiB
JavaScript
102 lines
2.3 KiB
JavaScript
import { test, given } from 'sazerac'
|
|
import DockerSize from './docker-size.service.js'
|
|
import { sizeDataNoTagSemVerSort } from './docker-fixtures.js'
|
|
|
|
describe('DockerSize', function () {
|
|
test(DockerSize.prototype.getSizeFromImageByLatestDate, () => {
|
|
given(
|
|
{
|
|
count: 0,
|
|
results: [],
|
|
},
|
|
'amd64',
|
|
).expectError('Not Found: repository not found')
|
|
given(
|
|
{
|
|
count: 1,
|
|
results: [
|
|
{
|
|
full_size: 300000000,
|
|
name: 'next',
|
|
images: [{ architecture: 'amd64', size: 219939484 }],
|
|
},
|
|
],
|
|
},
|
|
'amd64',
|
|
).expect({
|
|
size: 219939484,
|
|
})
|
|
given({
|
|
count: 1,
|
|
results: [
|
|
{
|
|
full_size: 300000000,
|
|
name: 'next',
|
|
images: [
|
|
{ architecture: 'amd64', size: 219939484 },
|
|
{ architecture: 'arm64', size: 200000000 },
|
|
],
|
|
},
|
|
],
|
|
}).expect({
|
|
size: 300000000,
|
|
})
|
|
given(
|
|
{
|
|
count: 1,
|
|
results: [
|
|
{
|
|
full_size: 300000000,
|
|
name: 'next',
|
|
images: [
|
|
{ architecture: 'amd64', size: 219939484 },
|
|
{ architecture: 'arm64', size: 200000000 },
|
|
],
|
|
},
|
|
],
|
|
},
|
|
'arm64777',
|
|
).expectError('Not Found: architecture not found')
|
|
})
|
|
|
|
test(DockerSize.prototype.getSizeFromTag, () => {
|
|
given(
|
|
{
|
|
full_size: 300000000,
|
|
name: 'next',
|
|
images: [{ architecture: 'amd64', size: 219939484 }],
|
|
},
|
|
'amd64',
|
|
).expect({
|
|
size: 219939484,
|
|
})
|
|
given({
|
|
full_size: 300000000,
|
|
name: 'next',
|
|
images: [{ architecture: 'amd64', size: 219939484 }],
|
|
}).expect({
|
|
size: 300000000,
|
|
})
|
|
given(
|
|
{
|
|
full_size: 300000000,
|
|
name: 'next',
|
|
images: [{ architecture: 'amd64', size: 219939484 }],
|
|
},
|
|
'arm64777',
|
|
).expectError('Not Found: architecture not found')
|
|
})
|
|
|
|
test(DockerSize.prototype.getSizeFromImageByLatestSemver, () => {
|
|
given(sizeDataNoTagSemVerSort, 'amd64').expect({
|
|
size: 220000000,
|
|
})
|
|
given(sizeDataNoTagSemVerSort).expect({
|
|
size: 400000000,
|
|
})
|
|
given(sizeDataNoTagSemVerSort, 'nonexistentArch').expectError(
|
|
'Not Found: architecture not found',
|
|
)
|
|
})
|
|
})
|