Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add auto assertion database override to core test #1602

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 39 additions & 4 deletions core/main_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,11 @@ vars:
config {
type: "table",
database: dataform.projectConfig.vars.var1,
description: dataform.projectConfig.vars.var2
schema: "tableSchema",
description: dataform.projectConfig.vars.var2,
assertions: {
nonNull: [dataform.projectConfig.vars.var3],
}
}
select 1 AS \${dataform.projectConfig.vars.var3}`
);
Expand All @@ -223,6 +227,31 @@ select 1 AS \${dataform.projectConfig.vars.var3}`

expect(asPlainObject(result.compile.compiledGraph)).deep.equals(
asPlainObject({
assertions: [
{
canonicalTarget: {
name: "tableSchema_file_assertions_rowConditions"
},
dependencyTargets: [
{
database: "value1",
name: "file",
schema: "tableSchema"
}
],
fileName: "definitions/file.sqlx",
parentAction: {
database: "value1",
name: "file",
schema: "tableSchema"
},
query:
"\nSELECT\n 'value3 IS NOT NULL' AS failing_row_condition,\n *\nFROM `value1.tableSchema.file`\nWHERE NOT (value3 IS NOT NULL)\n",
target: {
name: "tableSchema_file_assertions_rowConditions"
}
}
],
dataformCoreVersion: "3.0.0",
graphErrors: {},
projectConfig: {
Expand All @@ -241,23 +270,29 @@ select 1 AS \${dataform.projectConfig.vars.var3}`
},
canonicalTarget: {
database: "value1",
name: "file"
name: "file",
schema: "tableSchema"
},
disabled: false,
enumType: "TABLE",
fileName: "definitions/file.sqlx",
query: "\n\nselect 1 AS value3",
target: {
database: "value1",
name: "file"
name: "file",
schema: "tableSchema"
},
type: "table"
}
],
targets: [
{
database: "value1",
name: "file"
name: "file",
schema: "tableSchema"
},
{
name: "tableSchema_file_assertions_rowConditions"
}
]
})
Expand Down
Loading