github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/updater/sources/local_test.go (about)

     1  // Copyright 2016 Keybase, Inc. All rights reserved. Use of
     2  // this source code is governed by the included BSD license.
     3  
     4  package sources
     5  
     6  import (
     7  	"path/filepath"
     8  	"runtime"
     9  	"testing"
    10  
    11  	"github.com/keybase/client/go/updater"
    12  	"github.com/keybase/go-logging"
    13  	"github.com/stretchr/testify/assert"
    14  	"github.com/stretchr/testify/require"
    15  )
    16  
    17  var log = &logging.Logger{Module: "test"}
    18  
    19  func TestLocalUpdateSource(t *testing.T) {
    20  	_, filename, _, _ := runtime.Caller(0)
    21  	path := filepath.Join(filepath.Dir(filename), "../test/test.zip")
    22  	jsonPath := filepath.Join(filepath.Dir(filename), "../test/update.json")
    23  	local := NewLocalUpdateSource(path, jsonPath, log)
    24  	assert.Equal(t, local.Description(), "Local")
    25  
    26  	update, err := local.FindUpdate(updater.UpdateOptions{})
    27  	require.NoError(t, err)
    28  	require.NotNil(t, update)
    29  }