buildx: hasAttestationType and resolveAttestationAttrs funcs

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2024-03-26 16:23:01 +01:00
parent de2888af87
commit 545f7cd6ea
4 changed files with 127 additions and 0 deletions

View File

@@ -244,6 +244,41 @@ describe('hasDockerExporter', () => {
});
});
describe('hasAttestationType', () => {
// prettier-ignore
test.each([
['type=provenance,mode=min', 'provenance', true],
['type=sbom,true', 'sbom', true],
['type=foo,bar', 'provenance', false],
])('given %p for %p returns %p', async (attrs: string, name: string, expected: boolean) => {
expect(Inputs.hasAttestationType(name, attrs)).toEqual(expected);
});
});
describe('resolveAttestationAttrs', () => {
// prettier-ignore
test.each([
[
'type=provenance,mode=min',
'type=provenance,mode=min'
],
[
'type=provenance,true',
'type=provenance,disabled=false'
],
[
'type=provenance,false',
'type=provenance,disabled=true'
],
[
'',
''
],
])('given %p', async (input: string, expected: string) => {
expect(Inputs.resolveAttestationAttrs(input)).toEqual(expected);
});
});
describe('hasGitAuthTokenSecret', () => {
// prettier-ignore
test.each([