...

Source file src/github.com/fergusstrange/embedded-postgres/cache_locator_test.go

Documentation: github.com/fergusstrange/embedded-postgres

     1  package embeddedpostgres
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func Test_defaultCacheLocator_NotExists(t *testing.T) {
    10  	locator := defaultCacheLocator("", func() (string, string, PostgresVersion) {
    11  		return "a", "b", "1.2.3"
    12  	})
    13  
    14  	cacheLocation, exists := locator()
    15  
    16  	assert.Contains(t, cacheLocation, ".embedded-postgres-go/embedded-postgres-binaries-a-b-1.2.3.txz")
    17  	assert.False(t, exists)
    18  }
    19  
    20  func Test_defaultCacheLocator_CustomPath(t *testing.T) {
    21  	locator := defaultCacheLocator("/custom/path", func() (string, string, PostgresVersion) {
    22  		return "a", "b", "1.2.3"
    23  	})
    24  
    25  	cacheLocation, exists := locator()
    26  
    27  	assert.Equal(t, cacheLocation, "/custom/path/embedded-postgres-binaries-a-b-1.2.3.txz")
    28  	assert.False(t, exists)
    29  }
    30  

View as plain text