github.com/kcmerrill/alfred@v0.0.0-20180727171036-06445dcb5e3d/pkg/alfred/command_test.go (about) 1 package alfred 2 3 import "testing" 4 import "os" 5 6 func TestCommandComponent(t *testing.T) { 7 tasks := make(map[string]Task) 8 task := Task{ 9 Dir: "/tmp/alfred/command", 10 Command: "touch myfile.txt", 11 } 12 c := InitialContext([]string{}) 13 c.Text.DisableFormatting = true 14 commandC(task, c, tasks) 15 16 // validate that it worked and that directory was created 17 if _, exists := os.Stat("/tmp/alfred/command/myfile.txt"); exists != nil { 18 t.Fatalf("file should have been created by command") 19 } 20 }