File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ package index
2
+
3
+ import (
4
+ "net/url"
5
+ "testing"
6
+
7
+ "github.com/arduino/go-paths-helper"
8
+ "github.com/stretchr/testify/require"
9
+ )
10
+
11
+ func TestInit (t * testing.T ) {
12
+ indexURL := "https://downloads.arduino.cc/packages/package_staging_index.json"
13
+ // Instantiate Index
14
+ tempDir := paths .New (t .TempDir ()).Join (".arduino-create" )
15
+ Index := Init (indexURL , tempDir )
16
+ require .DirExists (t , tempDir .String ())
17
+ fileName := "package_staging_index.json"
18
+ signatureName := fileName + ".sig"
19
+ parsedURL , _ := url .Parse (indexURL )
20
+ require .Equal (t , Index .IndexURL , * parsedURL )
21
+ require .Contains (t , Index .IndexFile .String (), fileName )
22
+ require .Contains (t , Index .IndexSignature .String (), signatureName )
23
+ require .FileExists (t , tempDir .Join (fileName ).String ())
24
+ require .FileExists (t , tempDir .Join (signatureName ).String ())
25
+ }
You can’t perform that action at this time.
0 commit comments