github.com/billybanfield/evergreen@v0.0.0-20170525200750-eeee692790f7/model/patch/patch_test.go (about)

     1  package patch
     2  
     3  import (
     4  	"testing"
     5  
     6  	. "github.com/smartystreets/goconvey/convey"
     7  )
     8  
     9  func TestConfigChanged(t *testing.T) {
    10  
    11  	Convey("With calling ConfigChanged with a remote configuration "+
    12  		"path", t, func() {
    13  
    14  		Convey("the function should return true if the config has changed", func() {
    15  			remoteConfigPath := "config/evergreen.yml"
    16  			p := &Patch{
    17  				Patches: []ModulePatch{{
    18  					PatchSet: PatchSet{
    19  						Summary: []Summary{{
    20  							Name:      remoteConfigPath,
    21  							Additions: 3,
    22  							Deletions: 3,
    23  						}},
    24  					},
    25  				}},
    26  			}
    27  			So(p.ConfigChanged(remoteConfigPath), ShouldBeTrue)
    28  		})
    29  
    30  		Convey("the function should not return true if the config has not changed", func() {
    31  			remoteConfigPath := "config/evergreen.yml"
    32  			p := &Patch{
    33  				Patches: []ModulePatch{{
    34  					PatchSet: PatchSet{
    35  						Summary: []Summary{{
    36  							Name:      "dakar",
    37  							Additions: 3,
    38  							Deletions: 3,
    39  						}},
    40  					},
    41  				}},
    42  			}
    43  			So(p.ConfigChanged(remoteConfigPath), ShouldBeFalse)
    44  		})
    45  	})
    46  }