fix: unmarshal legacyImports

This commit is contained in:
sh0rez 2020-02-28 23:22:41 +01:00
parent e28e7ff55b
commit fcac885ce2
No known key found for this signature in database
GPG key ID: 87C71DF9F8181FF1
3 changed files with 5 additions and 4 deletions

View file

@ -28,7 +28,7 @@ import (
"github.com/jsonnet-bundler/jsonnet-bundler/spec/v1/deps"
)
const initContents = `{"version": 1, "dependencies": [], "legacyImports": false}`
const initContents = `{"version": 1, "dependencies": [], "legacyImports": true}`
func TestInstallCommand(t *testing.T) {
testInstallCommandWithJsonnetHome(t, "vendor")
@ -59,14 +59,14 @@ func testInstallCommandWithJsonnetHome(t *testing.T, jsonnetHome string) {
Name: "OneURL",
URIs: []string{"github.com/jsonnet-bundler/jsonnet-bundler@v0.1.0"},
ExpectedCode: 0,
ExpectedJsonnetFile: []byte(`{"version": 1, "dependencies": [{"source": {"git": {"remote": "https://github.com/jsonnet-bundler/jsonnet-bundler", "subdir": ""}}, "version": "v0.1.0"}], "legacyImports": false}`),
ExpectedJsonnetFile: []byte(`{"version": 1, "dependencies": [{"source": {"git": {"remote": "https://github.com/jsonnet-bundler/jsonnet-bundler", "subdir": ""}}, "version": "v0.1.0"}], "legacyImports": true}`),
ExpectedJsonnetLockFile: []byte(`{"version": 1, "dependencies": [{"source": {"git": {"remote": "https://github.com/jsonnet-bundler/jsonnet-bundler", "subdir": ""}}, "version": "080f157c7fb85ad0281ea78f6c641eaa570a582f", "sum": "W1uI550rQ66axRpPXA2EZDquyPg/5PHZlvUz1NEzefg="}], "legacyImports": false}`),
},
{
Name: "Local",
URIs: []string{"jsonnet/foobar"},
ExpectedCode: 0,
ExpectedJsonnetFile: []byte(`{"version": 1, "dependencies": [{"source": {"local": {"directory": "jsonnet/foobar"}}, "version": ""}], "legacyImports": false}`),
ExpectedJsonnetFile: []byte(`{"version": 1, "dependencies": [{"source": {"local": {"directory": "jsonnet/foobar"}}, "version": ""}], "legacyImports": true}`),
ExpectedJsonnetLockFile: []byte(`{"version": 1, "dependencies": [{"source": {"local": {"directory": "jsonnet/foobar"}}, "version": ""}], "legacyImports": false}`),
},
}