bake: hasGitAuthTokenSecret func

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2025-01-10 09:14:36 +01:00
parent e36200f754
commit 73473a8d30
4 changed files with 74 additions and 0 deletions

View File

@@ -444,3 +444,44 @@ describe('hasDockerExporter', () => {
expect(Bake.hasDockerExporter(def, load)).toEqual(expected);
});
});
describe('hasGitAuthTokenSecret', () => {
// prettier-ignore
test.each([
[
{
"target": {
"reg": {
"secret": [
{
"id": "A_SECRET",
"env": "A_SECRET"
}
]
},
}
} as unknown as BakeDefinition,
false
],
[
{
"target": {
"reg": {
"secret": [
{
"id": "A_SECRET",
"env": "A_SECRET"
},
{
"id": "GIT_AUTH_TOKEN"
}
]
},
}
} as unknown as BakeDefinition,
true
],
])('given %o returns %p', async (def: BakeDefinition, expected: boolean) => {
expect(Bake.hasGitAuthTokenSecret(def)).toEqual(expected);
});
});