feat(taglist): improve visibility of multi-architecture images (#271)

closes #271
This commit is contained in:
Joxit 2023-06-03 15:33:25 +02:00
parent affb0572c9
commit 4091baa341
No known key found for this signature in database
GPG key ID: F526592B8E012263
4 changed files with 88 additions and 6 deletions

View file

@ -1,4 +1,4 @@
import { supportListManifest, filterWrongManifests } from '../src/scripts/docker-image.js';
import { supportListManifest, filterWrongManifests, platformToString } from '../src/scripts/docker-image.js';
import { dockerManifestList } from './fixtures/docker-manifest-list.js';
import { ociImageIndexLayer } from './fixtures/oci-image-index-layer.js';
import { ociImageIndexManifest } from './fixtures/oci-image-index-manifest.js';
@ -36,10 +36,18 @@ describe('docker-image', () => {
);
});
it('should return all manifests for `application/vnd.oci.image.index.v1+json`', () => {
assert.equal(
filterWrongManifests(ociImageIndexManifest['application/vnd.oci.image.index.v1+json']).length,
2
);
assert.equal(filterWrongManifests(ociImageIndexManifest['application/vnd.oci.image.index.v1+json']).length, 2);
});
});
describe('platformToString', () => {
it('should return unknown when the platform is not found', () => {
assert.equal(platformToString(), 'unknown');
assert.equal(platformToString({}), 'unknown');
});
it('should format the platform', () => {
assert.equal(platformToString({ os: 'linux', architecture: 'amd64' }), 'amd64');
assert.equal(platformToString({ os: 'linux', architecture: 'arm', variant: 'v7' }), 'armv7');
assert.equal(platformToString({ architecture: 'arm', variant: 'v7' }), 'armv7');
});
});
});