add unit test for multiple sync patterns
@@ -91,6 +91,39 @@ func TestNewSyncItem(t *testing.T) {
},
shouldErr: true,
},
+ {
+ description: "multiple sync patterns",
+ artifact: &latest.Artifact{
+ ImageName: "test",
+ Sync: map[string]string{
+ "*.js": ".",
+ "*.html": ".",
+ "*.json": ".",
+ },
+ Workspace: "node",
+ },
+ builds: []build.Artifact{
+ {
+ ImageName: "test",
+ Tag: "test:123",
+ },
+ },
+ evt: watch.Events{
+ Added: []string{filepath.Join("node", "index.html")},
+ Modified: []string{filepath.Join("node", "server.js")},
+ Deleted: []string{filepath.Join("node", "package.json")},
+ },
+ expected: &Item{
+ Image: "test:123",
+ Copy: map[string]string{
+ filepath.Join("node", "server.js"): "server.js",
+ filepath.Join("node", "index.html"): "index.html",
+ },
+ Delete: map[string]string{
+ filepath.Join("node", "package.json"): "package.json",
+ },
+ },
+ },
{
description: "sync all",
artifact: &latest.Artifact{
