-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ernst von Oelsen <[email protected]>
- Loading branch information
1 parent
d6fbd0e
commit 04ac63b
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2024 The Carvel Authors. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package files_test | ||
|
||
import ( | ||
"carvel.dev/ytt/pkg/files" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
"testing" | ||
) | ||
|
||
func TestNewSortedFilesFromPaths(t *testing.T) { | ||
inputPaths := []string{ | ||
"../yamltemplate/filetests/def.tpltest", | ||
"https://example.org/test.yaml?hello=world&foo=bar", | ||
"an/overwritten/path/to/file.yaml=https://example.org/test.yaml?hello=world&foo=bar"} | ||
filesToProcess, err := files.NewSortedFilesFromPaths(inputPaths, files.SymlinkAllowOpts{true, []string{}}) | ||
|
||
require.NoError(t, err) | ||
|
||
assert.Equal(t, filesToProcess[0].RelativePath(), "def.tpltest") | ||
assert.Equal(t, filesToProcess[1].RelativePath(), "test.yaml") | ||
assert.Equal(t, filesToProcess[1].Description(), "HTTP URL 'https://example.org/test.yaml?hello=world&foo=bar'") | ||
assert.Equal(t, filesToProcess[2].RelativePath(), "an/overwritten/path/to/file.yaml") | ||
assert.Equal(t, filesToProcess[2].Description(), "HTTP URL 'https://example.org/test.yaml?hello=world&foo=bar'") | ||
} |