File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
internal/orchestrator/app Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ func Load(appPath string) (ArduinoApp, error) {
4848 return ArduinoApp {}, fmt .Errorf ("app path is not valid: %w" , err )
4949 }
5050 if ! exist {
51- return ArduinoApp {}, fmt .Errorf ("no such file or directory: %s" , path )
51+ return ArduinoApp {}, fmt .Errorf ("app path must be a directory: %s" , path )
5252 }
5353 path , err = path .Abs ()
5454 if err != nil {
Original file line number Diff line number Diff line change @@ -25,13 +25,26 @@ import (
2525)
2626
2727func TestLoad (t * testing.T ) {
28- t .Run ("empty" , func (t * testing.T ) {
28+ t .Run ("empty path returns an error " , func (t * testing.T ) {
2929 app , err := Load ("" )
3030 assert .Error (t , err )
3131 assert .Empty (t , app )
32+ assert .Contains (t , err .Error (), "empty" )
3233 })
3334
34- t .Run ("AppSimple" , func (t * testing.T ) {
35+ t .Run ("it fails if the app path is an existing file" , func (t * testing.T ) {
36+ _ , err := Load ("testdata/app.yaml" )
37+ assert .Error (t , err )
38+ assert .Contains (t , err .Error (), "app path must be a directory" )
39+ })
40+
41+ t .Run ("it fails if the app path does not exist" , func (t * testing.T ) {
42+ _ , err := Load ("testdata/this-folder-does-not-exist" )
43+ assert .Error (t , err )
44+ assert .Contains (t , err .Error (), "app path is not valid" )
45+ })
46+
47+ t .Run ("it load an app correctly" , func (t * testing.T ) {
3548 app , err := Load ("testdata/AppSimple" )
3649 assert .NoError (t , err )
3750 assert .NotEmpty (t , app )
You can’t perform that action at this time.
0 commit comments