Skip to content

Commit e65875d

Browse files
committed
tag parsing tests
1 parent 1c82f72 commit e65875d

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

apps/webapp/test/getDeploymentImageRef.test.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,46 @@ describe("parseEcrRegistry", () => {
170170
}
171171
});
172172
});
173+
174+
describe("parseRegistryTags", () => {
175+
it("should handle empty or null input", () => {
176+
expect(parseRegistryTags("")).toEqual([]);
177+
expect(parseRegistryTags(",,,")).toEqual([]);
178+
});
179+
180+
it("should parse key-only tags", () => {
181+
expect(parseRegistryTags("key1,key2")).toEqual([
182+
{ Key: "key1", Value: "" },
183+
{ Key: "key2", Value: "" },
184+
]);
185+
});
186+
187+
it("should parse key-value tags", () => {
188+
expect(parseRegistryTags("key1=value1,key2=value2")).toEqual([
189+
{ Key: "key1", Value: "value1" },
190+
{ Key: "key2", Value: "value2" },
191+
]);
192+
});
193+
194+
it("should handle mixed key-only and key-value tags", () => {
195+
expect(parseRegistryTags("key1,key2=value2,key3")).toEqual([
196+
{ Key: "key1", Value: "" },
197+
{ Key: "key2", Value: "value2" },
198+
{ Key: "key3", Value: "" },
199+
]);
200+
});
201+
202+
it("should handle whitespace", () => {
203+
expect(parseRegistryTags(" key1 , key2 = value2 ")).toEqual([
204+
{ Key: "key1", Value: "" },
205+
{ Key: "key2", Value: "value2" },
206+
]);
207+
});
208+
209+
it("should skip invalid tags", () => {
210+
expect(parseRegistryTags("=value,key1,=,key2=value2")).toEqual([
211+
{ Key: "key1", Value: "" },
212+
{ Key: "key2", Value: "value2" },
213+
]);
214+
});
215+
});

0 commit comments

Comments
 (0)