Skip to content

Commit 6cbdb73

Browse files
committed
Added integration test
1 parent 3b29cae commit 6cbdb73

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Diff for: internal/integrationtest/core/core_test.go

+27
Original file line numberDiff line numberDiff line change
@@ -1366,3 +1366,30 @@ func TestCoreInstallWithWrongArchiveSize(t *testing.T) {
13661366
_, _, err = cli.Run("--additional-urls", "https://raw.githubusercontent.com/geolink/opentracker-arduino-board/bf6158ebab0402db217bfb02ea61461ddc6f2940/package_opentracker_index.json", "core", "install", "opentracker:[email protected]")
13671367
require.NoError(t, err)
13681368
}
1369+
1370+
func TestCoreOverrideIfInstalledInSketchbook(t *testing.T) {
1371+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
1372+
defer env.CleanUp()
1373+
1374+
_, _, err := cli.Run("core", "update-index")
1375+
require.NoError(t, err)
1376+
1377+
// Install [email protected]
1378+
_, _, err = cli.Run("core", "install", "arduino:[email protected]")
1379+
require.NoError(t, err)
1380+
1381+
// Copy it in the sketchbook hardware folder (simulate a user installed core)
1382+
// avrCore := cli.DataDir().Join("packages", "arduino", "hardware", "avr", "1.8.5")
1383+
// avrCoreCopy := cli.SketchbookDir().Join("hardware", "arduino", "avr")
1384+
// require.NoError(t, avrCoreCopy.Parent().MkdirAll())
1385+
// require.NoError(t, avrCore.CopyDirTo(avrCoreCopy))
1386+
1387+
// Install [email protected]
1388+
_, _, err = cli.Run("core", "install", "arduino:[email protected]")
1389+
require.NoError(t, err)
1390+
1391+
// List cores and check that version 1.8.5 is listed
1392+
stdout, _, err := cli.Run("core", "list", "--json")
1393+
require.NoError(t, err)
1394+
requirejson.Query(t, stdout, `.platforms.[] | select(.id=="arduino:avr") | .installed_version`, `"1.8.5"`)
1395+
}

0 commit comments

Comments
 (0)