-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: EventFactory saves where conditions if any. Docs updated.
- Loading branch information
1 parent
b7a1a1c
commit dda313f
Showing
58 changed files
with
705 additions
and
121 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
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,46 @@ | ||
const ga4 = require("index"); | ||
const helpers = require("dataform-ga4-helpers"); | ||
|
||
const { rows } = require("includes/tests/data/events_with_where.js"); | ||
const { rows: result } = require("includes/tests/data/purchase_result.js"); | ||
|
||
// console.log('rows',rows); | ||
|
||
// Base session config | ||
const eventConfig = { | ||
database: constants.GA4_DATABASE, | ||
dataset: dataform.projectConfig.vars.GA4_DATASET, | ||
incrementalTableName: dataform.projectConfig.vars.GA4_TABLE, | ||
nonIncrementalTableName: dataform.projectConfig.vars.GA4_TABLE, | ||
nonIncrementalTableEventStepWhere: "device.category = 'desktop'", | ||
}; | ||
|
||
const ef = new ga4.EventFactory(eventConfig); | ||
let purchase = ef.createPurchase(); | ||
|
||
// Rename table | ||
purchase.target = { | ||
tableName: "event_with_where", | ||
}; | ||
|
||
// Unit testing working only for table type | ||
purchase.getConfig = () => { | ||
return { | ||
type: "table", | ||
}; | ||
}; | ||
|
||
purchase.publish(); | ||
|
||
// Run tests | ||
test("test_event_with_where") | ||
.dataset("event_with_where") | ||
.input( | ||
{ | ||
database: constants.GA4_DATABASE, | ||
schema: dataform.projectConfig.vars.GA4_DATASET, | ||
name: dataform.projectConfig.vars.GA4_TABLE, | ||
}, | ||
helpers.getSqlUnionAllFromRows(rows) | ||
) | ||
.expect(helpers.getSqlUnionAllFromRows(result)); |
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
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
Binary file added
BIN
+64.5 KB
docs/assets/images/dataform_json-acd10f130d50abaf33a6f6c23a4a4e2c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+178 KB
docs/assets/images/service_account-80a672afe3ac5f8205c027c53f796a45.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.