sf-flow-coverage 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +52 -13
  3. package/lib/commands/flowcov/gate.d.ts +1 -0
  4. package/lib/commands/flowcov/gate.js +12 -1
  5. package/lib/commands/flowcov/gate.js.map +1 -1
  6. package/lib/core/apexTemplate.d.ts +10 -2
  7. package/lib/core/apexTemplate.js +327 -54
  8. package/lib/core/apexTemplate.js.map +1 -1
  9. package/lib/core/filterFormula.d.ts +10 -0
  10. package/lib/core/filterFormula.js +153 -0
  11. package/lib/core/filterFormula.js.map +1 -0
  12. package/lib/core/flowFingerprint.d.ts +27 -0
  13. package/lib/core/flowFingerprint.js +128 -0
  14. package/lib/core/flowFingerprint.js.map +1 -0
  15. package/lib/core/flowGraph.d.ts +94 -0
  16. package/lib/core/flowGraph.js +288 -0
  17. package/lib/core/flowGraph.js.map +1 -0
  18. package/lib/core/flowValues.d.ts +14 -0
  19. package/lib/core/flowValues.js +43 -0
  20. package/lib/core/flowValues.js.map +1 -0
  21. package/lib/core/flowXml.d.ts +1 -1
  22. package/lib/core/flowXml.js +6 -39
  23. package/lib/core/flowXml.js.map +1 -1
  24. package/lib/core/gate.d.ts +12 -1
  25. package/lib/core/gate.js +60 -6
  26. package/lib/core/gate.js.map +1 -1
  27. package/lib/core/git.d.ts +7 -2
  28. package/lib/core/git.js +104 -58
  29. package/lib/core/git.js.map +1 -1
  30. package/lib/core/orgCoverageSource.d.ts +6 -0
  31. package/lib/core/orgCoverageSource.js +43 -8
  32. package/lib/core/orgCoverageSource.js.map +1 -1
  33. package/lib/core/requiredFields.d.ts +39 -2
  34. package/lib/core/requiredFields.js +131 -6
  35. package/lib/core/requiredFields.js.map +1 -1
  36. package/lib/core/scaffold.js +32 -5
  37. package/lib/core/scaffold.js.map +1 -1
  38. package/lib/core/types.d.ts +29 -1
  39. package/messages/flowcov.gate.md +17 -1
  40. package/messages/flowcov.readiness.md +2 -2
  41. package/messages/flowcov.scaffold.md +3 -1
  42. package/oclif.manifest.json +20 -5
  43. package/package.json +10 -9
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.0](https://github.com/mcarvin8/sf-flow-coverage/compare/v0.2.0...v0.3.0) (2026-11-20)
4
+
5
+
6
+ ### Features
7
+
8
+ * **gate:** compare changed Flows with the org version via --content-check ([#9](https://github.com/mcarvin8/sf-flow-coverage/issues/9)) ([841c417](https://github.com/mcarvin8/sf-flow-coverage/commit/841c4170e361a0669727b851823ecfe4d00b9a0d))
9
+ * **gate:** fail Flows whose org version was likely deployed inactive ([#7](https://github.com/mcarvin8/sf-flow-coverage/issues/7)) ([5564801](https://github.com/mcarvin8/sf-flow-coverage/commit/55648016d9be109bdc853ef300d70d6c33bb117e))
10
+ * **scaffold:** assert what record-triggered Flows do ([#13](https://github.com/mcarvin8/sf-flow-coverage/issues/13)) ([9ef29b5](https://github.com/mcarvin8/sf-flow-coverage/commit/9ef29b5245b6f25d660005231b3e94907c32a2ed))
11
+ * **scaffold:** insert parent records for required and criteria lookups ([#12](https://github.com/mcarvin8/sf-flow-coverage/issues/12)) ([cc57296](https://github.com/mcarvin8/sf-flow-coverage/commit/cc57296d58439531b5f2f2963e2da02ddc158484))
12
+ * **scaffold:** meet comparison, string, and IsChanged entry criteria ([#10](https://github.com/mcarvin8/sf-flow-coverage/issues/10)) ([5451dbb](https://github.com/mcarvin8/sf-flow-coverage/commit/5451dbb66921d59ad00812ed18c060dfeb1c992e))
13
+ * **scaffold:** meet simple entry-criteria formulas ([#11](https://github.com/mcarvin8/sf-flow-coverage/issues/11)) ([1a5b8e4](https://github.com/mcarvin8/sf-flow-coverage/commit/1a5b8e4257462e51092077d9746dcc6ad3af1e9d))
14
+
15
+ ## [0.2.0](https://github.com/mcarvin8/sf-flow-coverage/compare/v0.1.0...v0.2.0) (2026-11-20)
16
+
17
+
18
+ ### Features
19
+
20
+ * read git history with tsgit instead of the git binary ([#5](https://github.com/mcarvin8/sf-flow-coverage/issues/5)) ([cb61d75](https://github.com/mcarvin8/sf-flow-coverage/commit/cb61d75f9e188b49b7c4e1119bc55fff53db76a7))
21
+ * **scaffold:** fill fields for IsNull false entry criteria ([#3](https://github.com/mcarvin8/sf-flow-coverage/issues/3)) ([bac20b4](https://github.com/mcarvin8/sf-flow-coverage/commit/bac20b467760b1ca4b8b1ecb99cc675c4019cda1))
22
+
3
23
  ## [0.1.0](https://github.com/mcarvin8/sf-flow-coverage/compare/v0.0.1...v0.1.0) (2026-11-20)
4
24
 
5
25
 
package/README.md CHANGED
@@ -3,6 +3,8 @@
3
3
  [![NPM](https://img.shields.io/npm/v/sf-flow-coverage.svg?label=sf-flow-coverage)](https://www.npmjs.com/package/sf-flow-coverage)
4
4
  [![Downloads/week](https://img.shields.io/npm/dw/sf-flow-coverage.svg)](https://npmjs.org/package/sf-flow-coverage)
5
5
  [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://raw.githubusercontent.com/mcarvin8/sf-flow-coverage/refs/heads/main/LICENSE.md)
6
+ [![codecov](https://codecov.io/gh/mcarvin8/sf-flow-coverage/graph/badge.svg?token=7R49P3RQ47)](https://codecov.io/gh/mcarvin8/sf-flow-coverage)
7
+ [![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fmcarvin8%2Fsf-flow-coverage%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/mcarvin8/sf-flow-coverage/main)
6
8
 
7
9
  Get your Salesforce org ready to deploy Flows as active.
8
10
 
@@ -12,6 +14,7 @@ Most production orgs deploy Flows as inactive and activate them by hand, because
12
14
  <details>
13
15
  <summary>Table of Contents</summary>
14
16
 
17
+ - [Requirements](#requirements)
15
18
  - [Install](#install)
16
19
  - [Quick start](#quick-start)
17
20
  - [How coverage is measured](#how-coverage-is-measured)
@@ -26,9 +29,14 @@ Most production orgs deploy Flows as inactive and activate them by hand, because
26
29
 
27
30
  ---
28
31
 
29
- ## Install
32
+ ## Requirements
33
+
34
+ - [Salesforce CLI](https://developer.salesforce.com/tools/salesforcecli)
35
+ - Node.js 22.22 or later
36
+ - An authenticated Salesforce org for `readiness` and `gate`. `scaffold` works without one, but with one it fills in required fields from the org.
37
+ - No `git` binary. Git history is read with [tsgit](https://github.com/scolladon/tsgit), a pure TypeScript git implementation. `gate --from` and the change counts in `readiness` still need to run inside a git repository checkout.
30
38
 
31
- Requires the [Salesforce CLI](https://developer.salesforce.com/tools/salesforcecli) and Node.js 22.19 or later.
39
+ ## Install
32
40
 
33
41
  ```bash
34
42
  sf plugins install sf-flow-coverage@x.y.z
@@ -38,7 +46,7 @@ sf plugins install sf-flow-coverage@x.y.z
38
46
 
39
47
  ```bash
40
48
  # 1. Run Apex tests so the org's Flow coverage is current
41
- sf apex run test --test-level RunLocalTests --wait 60 --target-org prod
49
+ sf apex run test --test-level RunLocalTests --code-coverage --wait 60 --target-org prod
42
50
 
43
51
  # 2. See how far you are from 75%, and which Flows to cover first
44
52
  sf flowcov readiness --target-org prod --since "6 months ago"
@@ -53,7 +61,8 @@ sf flowcov gate --target-org ci-sandbox --from origin/main --to HEAD
53
61
  ## How coverage is measured
54
62
 
55
63
  - **What counts.** Active Flows with the process types Salesforce counts toward deploy-as-active: autolaunched Flows (including record-triggered, platform event and schedule-triggered Flows) and Process Builder processes. Screen Flows don't count.
56
- - **Where it comes from.** Salesforce records which Flow versions each Apex test runs in the Tooling API `FlowTestCoverage` object when Apex tests run in the org. All three commands read it, so run your Apex tests before using them. Check-only deployments (`sf project deploy validate`) run tests but don't record Flow coverage, so use `sf apex run test` or a real deployment.
64
+ - **Where it comes from.** Salesforce records which Flow versions each Apex test runs in the Tooling API `FlowTestCoverage` object when Apex tests run in the org. All three commands read it, so run your Apex tests before using them.
65
+ - **Run tests with `--code-coverage`.** Without `--code-coverage`, `sf apex run test` skips coverage and Salesforce records no Flow coverage. Check-only deployments (`sf project deploy validate`) don't record it either.
57
66
  - **Only Apex counts.** Flow Builder tests and Flow Test Mode (Winter '27) don't count toward the 75% requirement, so `scaffold` generates Apex tests, not Flow test metadata. The coverage source is pluggable, so if Salesforce starts counting Test Mode coverage it can be added without changing the commands.
58
67
 
59
68
  ## Readiness report
@@ -69,7 +78,7 @@ Pass `--fail-if-not-ready` to exit with code 1 below the threshold.
69
78
  Coverage is read from the target org, so in CI:
70
79
 
71
80
  1. Deploy the branch to a sandbox or scratch org.
72
- 2. Run Apex tests there.
81
+ 2. Run Apex tests there with `sf apex run test --code-coverage`.
73
82
  3. Run the gate against that org.
74
83
 
75
84
  The gate checks the Flow's active version in the org (or its latest version if none is active), and prints that version in the result.
@@ -86,9 +95,9 @@ The gate checks the Flow's active version in the org (or its latest version if n
86
95
  | Schedule-triggered | Starts the Flow directly, since Apex tests can't fire the schedule. |
87
96
  | Process Builder | A placeholder test to fill in. |
88
97
 
89
- With a target org (`--target-org` or your default org), the command describes each object the test creates and fills in its required fields: text, numbers, dates, and the default picklist value. Lookups it can't make up are left as TODOs. Without an org, only common standard objects (Account, Contact, Opportunity, and so on) get required fields.
98
+ With a target org (`--target-org` or your default org), the command describes each object the test creates and fills in its required fields: text, numbers, dates, and the default picklist value. It also meets "is not null" entry criteria (`IsNull` `false`) by giving those fields a value. Lookups it can't make up are left as TODOs. Without an org, only common standard objects (Account, Contact, Opportunity, and so on) get required fields.
90
99
 
91
- Every generated test has TODOs for anything it couldn't fill in, entry criteria it couldn't set (formulas, cross-object fields), and real assertions. Expect some generated tests to fail until you fill these in: a failure from the Flow's own validation still shows the Flow ran. Existing classes aren't overwritten unless you pass `--force`.
100
+ Every generated test has TODOs for anything it couldn't fill in, entry criteria it couldn't set (formulas, cross-object fields, other operators), and real assertions. Expect some generated tests to fail until you fill these in: a failure from the Flow's own validation still shows the Flow ran. Existing classes aren't overwritten unless you pass `--force`.
92
101
 
93
102
  ## CLI Command Reference
94
103
 
@@ -104,13 +113,16 @@ Require Apex test coverage for every Flow a pull request changes.
104
113
  ```
105
114
  USAGE
106
115
  $ sf flowcov gate -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [--from <value> | --flow
107
- <value>...] [--to <value>] [-d <value>] [--min-element-coverage <value>]
116
+ <value>...] [--to <value>] [-d <value>] [--min-element-coverage <value>] [--content-check warn|fail|off]
108
117
 
109
118
  FLAGS
110
119
  -d, --project-dir=<value> [default: .] Git repository to read changed Flows from.
111
120
  -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
112
121
  configuration variable is already set.
113
122
  --api-version=<value> Override the api version used for api requests made by this command
123
+ --content-check=<option> [default: warn] What to do when a changed Flow's content differs from the org's
124
+ version.
125
+ <options: warn|fail|off>
114
126
  --flow=<value>... Flow API name to check. Use instead of --from to skip git.
115
127
  --from=<value> Git ref the pull request merges into (the gate compares from the merge base of
116
128
  this ref).
@@ -129,7 +141,17 @@ DESCRIPTION
129
141
  between --from and --to must be run by at least one Apex test, and optionally reach a minimum element coverage.
130
142
 
131
143
  Coverage is read from FlowTestCoverage in the target org. Deploy the branch to the target org and run Apex tests there
132
- before running the gate. Flows that don't count toward deploy-as-active (screen Flows, inactive Flows) are skipped.
144
+ with `sf apex run test --code-coverage` before running the gate. Without `--code-coverage`, Salesforce records no Flow
145
+ coverage. Flows that don't count toward deploy-as-active (screen Flows, inactive Flows) are skipped.
146
+
147
+ The gate also fails a Flow when the org has no active version of it, or when its active version is older than its
148
+ latest version. Both usually mean the branch was deployed inactive, so the org's coverage doesn't belong to the
149
+ version in the pull request.
150
+
151
+ With --from, the gate also compares each changed Flow at --to with the org's version: process type, start trigger and
152
+ entry criteria, and the names of its elements and resources. A difference usually means the branch wasn't deployed to
153
+ the org. By default this is a warning; use --content-check to fail instead, or to skip the comparison. The comparison
154
+ doesn't look inside elements, so it can miss a change that only edits an existing element.
133
155
 
134
156
  Exits with code 1 when any Flow fails.
135
157
 
@@ -142,9 +164,19 @@ EXAMPLES
142
164
 
143
165
  $ sf flowcov gate --target-org ci-sandbox --from origin/main --min-element-coverage 60
144
166
 
167
+ Fail when the org runs a different version of a changed Flow than the branch:
168
+
169
+ $ sf flowcov gate --target-org ci-sandbox --from origin/main --content-check fail
170
+
145
171
  Check named Flows without git:
146
172
 
147
173
  $ sf flowcov gate --target-org ci-sandbox --flow Account_After_Save --flow Close_Cases
174
+
175
+ FLAG DESCRIPTIONS
176
+ --content-check=warn|fail|off What to do when a changed Flow's content differs from the org's version.
177
+
178
+ "warn" prints a warning, "fail" fails a Flow that would otherwise pass, and "off" skips the comparison (and its one
179
+ Tooling API query per Flow). Only applies with --from.
148
180
  ```
149
181
 
150
182
  _See code: [src/commands/flowcov/gate.ts](https://github.com/mcarvin8/sf-flow-coverage/blob/main/src/commands/flowcov/gate.ts)_
@@ -164,7 +196,8 @@ FLAGS
164
196
  configuration variable is already set.
165
197
  --api-version=<value> Override the api version used for api requests made by this command
166
198
  --fail-if-not-ready Exit with code 1 when the org is below the threshold.
167
- --since=<value> Only count commits after this date (any value `git log --since` accepts).
199
+ --since=<value> Only count commits after this date: a date (2026-01-31) or "<n> days|weeks|months|years
200
+ ago".
168
201
  --threshold=<value> [default: 75] Coverage percentage the org must reach.
169
202
 
170
203
  GLOBAL FLAGS
@@ -179,8 +212,9 @@ DESCRIPTION
179
212
  org-wide percentage against the threshold, and lists the uncovered Flows (ranked by how often they change in git) and
180
213
  the Apex tests that already run each covered Flow.
181
214
 
182
- FlowTestCoverage is filled in when Apex tests run in the org. Run your Apex tests first (for example, `sf apex run
183
- test --test-level RunLocalTests --wait 60`) so the report is current.
215
+ FlowTestCoverage is filled in when Apex tests run in the org. Run your Apex tests first with coverage turned on (for
216
+ example, `sf apex run test --test-level RunLocalTests --code-coverage --wait 60`) so the report is current. Without
217
+ `--code-coverage`, Salesforce records no Flow coverage.
184
218
 
185
219
  EXAMPLES
186
220
  Report readiness for the default org:
@@ -230,7 +264,12 @@ DESCRIPTION
230
264
  record-triggered Flows get a record built from the trigger object and entry criteria, autolaunched Flows are started
231
265
  with Flow.Interview and their input variables, and platform event Flows publish the event. When a target org is
232
266
  available (--target-org or a default org), the command describes each object the test creates and fills in its
233
- required fields. The generated tests have TODOs for anything it can't fill in and placeholder assertions.
267
+ required fields, the fields the entry criteria need, and parent records for required lookups.
268
+
269
+ For record-triggered Flows, the command follows the Flow's elements for the record the test creates. It asserts the
270
+ fields the Flow is certain to set, and when the Flow is certain to stop the save with a custom error, the test expects
271
+ that error. Fields the Flow sets only on a decision outcome the command can't predict get commented-out assertions.
272
+ The generated tests have TODOs for anything the command can't fill in.
234
273
 
235
274
  Only Apex tests count toward deploying Flows as active, so this command generates Apex, not Flow Builder tests.
236
275
 
@@ -12,6 +12,7 @@ export default class FlowcovGate extends SfCommand<GateResult> {
12
12
  flow: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
13
  'project-dir': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
14
  'min-element-coverage': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
15
+ 'content-check': import("@oclif/core/interfaces").OptionFlag<"fail" | "off" | "warn", import("@oclif/core/interfaces").CustomOptions>;
15
16
  };
16
17
  run(): Promise<GateResult>;
17
18
  }
@@ -37,6 +37,12 @@ export default class FlowcovGate extends SfCommand {
37
37
  min: 0,
38
38
  max: 100,
39
39
  }),
40
+ 'content-check': Flags.option({
41
+ summary: messages.getMessage('flags.content-check.summary'),
42
+ description: messages.getMessage('flags.content-check.description'),
43
+ options: ['warn', 'fail', 'off'],
44
+ default: 'warn',
45
+ })(),
40
46
  };
41
47
  async run() {
42
48
  const { flags } = await this.parse(FlowcovGate);
@@ -59,6 +65,7 @@ export default class FlowcovGate extends SfCommand {
59
65
  source: new OrgCoverageSource(toolingQuery(connection)),
60
66
  candidates,
61
67
  minElementCoverage: flags['min-element-coverage'],
68
+ contentCheck: flags['content-check'],
62
69
  });
63
70
  this.table({
64
71
  data: result.flows.map((f) => ({
@@ -68,12 +75,16 @@ export default class FlowcovGate extends SfCommand {
68
75
  Reason: f.reason,
69
76
  })),
70
77
  });
78
+ for (const flow of result.flows) {
79
+ for (const warning of flow.warnings ?? [])
80
+ this.warn(`${flow.flowName}: ${warning}`);
81
+ }
71
82
  if (result.passed) {
72
83
  this.logSuccess(`Flow coverage gate passed for ${result.flows.length} Flow(s).`);
73
84
  }
74
85
  else {
75
86
  const failed = result.flows.filter((f) => f.status === 'fail').length;
76
- this.warn(`Flow coverage gate failed: ${failed} Flow(s) need Apex test coverage.`);
87
+ this.warn(`Flow coverage gate failed for ${failed} Flow(s). See the Reason column.`);
77
88
  process.exitCode = 1;
78
89
  }
79
90
  return result;
@@ -1 +1 @@
1
- {"version":3,"file":"gate.js","sourceRoot":"","sources":["../../../src/commands/flowcov/gate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAsB,MAAM,oBAAoB,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D,QAAQ,CAAC,kCAAkC,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC;AAE3E,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,SAAqB;IACrD,MAAM,CAAmB,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAClE,MAAM,CAAmB,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CA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AC,eAAe,CAAC;SACrC,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,CAAC;YACT,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC7B,IAAI,EAAE,CAAC,CAAC,QAAQ;gBAChB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE;gBAC9B,kBAAkB,EAAE,CAAC,CAAC,sBAAsB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,sBAAsB,GAAG;gBAChG,MAAM,EAAE,CAAC,CAAC,MAAM;aACjB,CAAC,CAAC;SACJ,CAAC,CAAC;QAEH,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YAChC,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,IAAI,EAAE;gBAAE,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC,CAAC;QACvF,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,IAAI,CAAC,UAAU,CAAC,iCAAiC,MAAM,CAAC,KAAK,CAAC,MAAM,WAAW,CAAC,CAAC;QACnF,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,MAAM,CAAC;YACtE,IAAI,CAAC,IAAI,CAAC,iCAAiC,MAAM,kCAAkC,CAAC,CAAC;YACrF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -1,4 +1,4 @@
1
- import type { RequiredFieldMap } from './requiredFields.js';
1
+ import { type RequiredFieldMap } from './requiredFields.js';
2
2
  import type { FlowMetadata } from './types.js';
3
3
  export type GeneratedApexTest = {
4
4
  className: string;
@@ -12,7 +12,15 @@ export declare function flowKind(flow: FlowMetadata): FlowKind;
12
12
  export type GenerateOptions = {
13
13
  /** Required fields per object from an org describe. Falls back to a built-in list for common standard objects. */
14
14
  requiredFields?: RequiredFieldMap;
15
+ /** A value for every field the org describe can fill, per object. Used to meet `IsNull false` entry criteria. */
16
+ fieldValues?: RequiredFieldMap;
17
+ /** A second value per field, different from `fieldValues`. Used to meet `IsChanged true` entry criteria. */
18
+ changedValues?: RequiredFieldMap;
19
+ /** The object each lookup field points to, per object. Fills required and `IsNull false` lookups. */
20
+ lookups?: Record<string, Record<string, string>>;
21
+ /** Fields that stay empty when a test doesn't set them, per object. Lets assertions follow the Flow's decisions. */
22
+ nullWhenUnset?: Record<string, string[]>;
15
23
  };
16
24
  /** Generates a starter Apex test class for a Flow from its metadata. */
17
- export declare function generateApexTest(flow: FlowMetadata, options?: GenerateOptions): GeneratedApexTest;
25
+ export declare function generateApexTest(source: FlowMetadata, options?: GenerateOptions): GeneratedApexTest;
18
26
  export declare function apexClassMetaXml(apiVersion: string): string;