Migrate configuration tests to captured resources
This commit is contained in:
@@ -23,8 +23,8 @@ func TestCollectionInputValidatesWithoutReadingSource(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if input.Destination.String() != "/collections/docs" || !input.Imports {
|
||||
t.Fatalf("collection input = %+v, want destination /collections/docs with imports enabled", input)
|
||||
if input.Destination.String() != "/promptkit/collections/docs" || !input.Imports {
|
||||
t.Fatalf("collection input = %+v, want destination /promptkit/collections/docs with imports enabled", input)
|
||||
}
|
||||
for _, namespace := range []string{"", " ", "docs/api"} {
|
||||
if _, err := promptkit.CollectionInput(namespace, configkit.NoSource()); !errors.Is(err, promptkit.ErrInvalidConfig) {
|
||||
@@ -51,7 +51,7 @@ func TestCollectionInputLoadsNativeImportsAndLaterOverride(t *testing.T) {
|
||||
Underlays: []configkit.Underlay{{Inputs: []configkit.Input{input}}},
|
||||
Main: &configkit.Input{
|
||||
Source: configkit.Mapping("later collection override", map[string]any{"prompts": []any{map[string]any{"id": "greeting", "inputs": []any{map[string]any{"name": "overridden"}}, "messages": []any{map[string]any{"role": "user", "content": "Updated"}}, "output": map[string]any{"format": "text", "validation_mode": "none"}}}}),
|
||||
Destination: configkit.Keys("collections", "docs"),
|
||||
Destination: configkit.Keys("promptkit", "collections", "docs"),
|
||||
},
|
||||
}})
|
||||
if err != nil {
|
||||
@@ -119,7 +119,7 @@ func TestCollectionInputLoadsEmbeddedImportsAndLaterOverride(t *testing.T) {
|
||||
Underlays: []configkit.Underlay{{Inputs: []configkit.Input{input}}},
|
||||
Main: &configkit.Input{
|
||||
Source: configkit.Mapping("later collection override", map[string]any{"prompts": []any{map[string]any{"id": "greeting", "inputs": []any{map[string]any{"name": "overridden"}}, "messages": []any{map[string]any{"role": "user", "content": "Updated"}}, "output": map[string]any{"format": "text", "validation_mode": "none"}}}}),
|
||||
Destination: configkit.Keys("collections", "docs"),
|
||||
Destination: configkit.Keys("promptkit", "collections", "docs"),
|
||||
},
|
||||
}})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user