"first_null_row" configuration option
This commit is contained in:
@@ -191,6 +191,34 @@ topdata:
|
||||
}
|
||||
}
|
||||
|
||||
func TestEffectiveConfigIncludesTopDataRowGeneration(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
writeProjectFile(t, filepath.Join(root, ConfigFile), `
|
||||
module:
|
||||
name: Test Module
|
||||
resref: testmod
|
||||
topdata:
|
||||
source: topdata
|
||||
row_generation:
|
||||
- namespace: portraits
|
||||
mode: first_null_row
|
||||
`)
|
||||
|
||||
proj, err := Load(root)
|
||||
if err != nil {
|
||||
t.Fatalf("Load returned error: %v", err)
|
||||
}
|
||||
|
||||
rules := proj.EffectiveConfig().TopData.RowGeneration
|
||||
if len(rules) != 1 {
|
||||
t.Fatalf("expected one topdata row generation rule, got %#v", rules)
|
||||
}
|
||||
got := rules[0]
|
||||
if got.Dataset != "portraits" || got.Namespace != "portraits" || got.Mode != "first_null_row" {
|
||||
t.Fatalf("unexpected topdata row generation rule: %#v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEffectiveConfigIncludesTopDataClassFeatInjections(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
writeProjectFile(t, filepath.Join(root, ConfigFile), `
|
||||
@@ -252,6 +280,12 @@ func TestValidateLayoutRejectsInvalidTopDataValueEncodings(t *testing.T) {
|
||||
{Dataset: "racialtypes/core", Column: "ECL", Value: 1},
|
||||
{Dataset: "", Column: "", Value: 0},
|
||||
},
|
||||
RowGeneration: []TopDataRowGenerationConfig{
|
||||
{Dataset: "portraits", Mode: "first_null_row"},
|
||||
{Dataset: "portraits", Mode: "after_base"},
|
||||
{Namespace: "placeabletypes", Mode: "unsupported"},
|
||||
{Mode: "first_null_row"},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -271,6 +305,9 @@ func TestValidateLayoutRejectsInvalidTopDataValueEncodings(t *testing.T) {
|
||||
"topdata.value_defaults[1] duplicates an earlier dataset/column default",
|
||||
"topdata.value_defaults[2].dataset is required",
|
||||
"topdata.value_defaults[2].column is required",
|
||||
"topdata.row_generation[1] duplicates an earlier dataset row generation rule",
|
||||
"topdata.row_generation[2].mode \"unsupported\" is not supported",
|
||||
"topdata.row_generation[3].dataset is required",
|
||||
} {
|
||||
if !strings.Contains(text, want) {
|
||||
t.Fatalf("expected validation error %q, got %v", want, err)
|
||||
|
||||
Reference in New Issue
Block a user