@accounter/opcn1214-generator 0.0.0-bootstrap.0 → 0.0.0-stage
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.
- package/README.md +2 -336
- package/package.json +3 -74
- package/.bob/cjs/api/generate.d.ts +0 -44
- package/.bob/cjs/api/generate.js +0 -115
- package/.bob/cjs/api/parse.d.ts +0 -28
- package/.bob/cjs/api/parse.js +0 -38
- package/.bob/cjs/api/response.d.ts +0 -24
- package/.bob/cjs/api/response.js +0 -75
- package/.bob/cjs/api/validate.d.ts +0 -16
- package/.bob/cjs/api/validate.js +0 -15
- package/.bob/cjs/codec/boolean.d.ts +0 -7
- package/.bob/cjs/codec/boolean.js +0 -49
- package/.bob/cjs/codec/date.d.ts +0 -6
- package/.bob/cjs/codec/date.js +0 -68
- package/.bob/cjs/codec/enum.d.ts +0 -4
- package/.bob/cjs/codec/enum.js +0 -26
- package/.bob/cjs/codec/numeric.d.ts +0 -56
- package/.bob/cjs/codec/numeric.js +0 -186
- package/.bob/cjs/codec/padding.d.ts +0 -10
- package/.bob/cjs/codec/padding.js +0 -26
- package/.bob/cjs/codec/percent.d.ts +0 -6
- package/.bob/cjs/codec/percent.js +0 -33
- package/.bob/cjs/codec/phone.d.ts +0 -4
- package/.bob/cjs/codec/phone.js +0 -48
- package/.bob/cjs/codec/record.d.ts +0 -18
- package/.bob/cjs/codec/record.js +0 -176
- package/.bob/cjs/codec/registry.d.ts +0 -8
- package/.bob/cjs/codec/registry.js +0 -27
- package/.bob/cjs/codec/sections.d.ts +0 -41
- package/.bob/cjs/codec/sections.js +0 -177
- package/.bob/cjs/codec/text.d.ts +0 -5
- package/.bob/cjs/codec/text.js +0 -29
- package/.bob/cjs/codec/types.d.ts +0 -36
- package/.bob/cjs/codec/types.js +0 -16
- package/.bob/cjs/codec/windows1255.d.ts +0 -9
- package/.bob/cjs/codec/windows1255.js +0 -38
- package/.bob/cjs/errors.d.ts +0 -32
- package/.bob/cjs/errors.js +0 -103
- package/.bob/cjs/file/assemble.d.ts +0 -17
- package/.bob/cjs/file/assemble.js +0 -28
- package/.bob/cjs/file/control.d.ts +0 -13
- package/.bob/cjs/file/control.js +0 -45
- package/.bob/cjs/file/parse.d.ts +0 -18
- package/.bob/cjs/file/parse.js +0 -478
- package/.bob/cjs/file/split.d.ts +0 -17
- package/.bob/cjs/file/split.js +0 -71
- package/.bob/cjs/index.d.ts +0 -16
- package/.bob/cjs/index.js +0 -28
- package/.bob/cjs/layout/2024/layout.generated.d.ts +0 -6919
- package/.bob/cjs/layout/2024/layout.generated.js +0 -7224
- package/.bob/cjs/layout/2025/index.d.ts +0 -6
- package/.bob/cjs/layout/2025/index.js +0 -10
- package/.bob/cjs/layout/capital-gains.d.ts +0 -9
- package/.bob/cjs/layout/capital-gains.js +0 -15
- package/.bob/cjs/layout/countries.d.ts +0 -5
- package/.bob/cjs/layout/countries.js +0 -10
- package/.bob/cjs/layout/freeze.d.ts +0 -5
- package/.bob/cjs/layout/freeze.js +0 -16
- package/.bob/cjs/layout/registry.d.ts +0 -10
- package/.bob/cjs/layout/registry.js +0 -32
- package/.bob/cjs/layout/types.d.ts +0 -82
- package/.bob/cjs/layout/types.js +0 -35
- package/.bob/cjs/model/codes.generated.d.ts +0 -48
- package/.bob/cjs/model/codes.generated.js +0 -628
- package/.bob/cjs/model/index.d.ts +0 -3
- package/.bob/cjs/model/index.js +0 -5
- package/.bob/cjs/model/input.d.ts +0 -543
- package/.bob/cjs/model/input.js +0 -24
- package/.bob/cjs/model/normalized.d.ts +0 -43
- package/.bob/cjs/model/normalized.js +0 -0
- package/.bob/cjs/model/options.d.ts +0 -14
- package/.bob/cjs/model/options.js +0 -0
- package/.bob/cjs/model/schema.d.ts +0 -594
- package/.bob/cjs/model/schema.js +0 -339
- package/.bob/cjs/normalize/canonical.d.ts +0 -13
- package/.bob/cjs/normalize/canonical.js +0 -288
- package/.bob/cjs/normalize/capital-gains/assets.d.ts +0 -37
- package/.bob/cjs/normalize/capital-gains/assets.js +0 -94
- package/.bob/cjs/normalize/capital-gains/index.d.ts +0 -61
- package/.bob/cjs/normalize/capital-gains/index.js +0 -149
- package/.bob/cjs/normalize/capital-gains/no-withholding.d.ts +0 -18
- package/.bob/cjs/normalize/capital-gains/no-withholding.js +0 -36
- package/.bob/cjs/normalize/capital-gains/other.d.ts +0 -54
- package/.bob/cjs/normalize/capital-gains/other.js +0 -122
- package/.bob/cjs/normalize/capital-gains/section6.d.ts +0 -7
- package/.bob/cjs/normalize/capital-gains/section6.js +0 -13
- package/.bob/cjs/normalize/capital-gains/securities.d.ts +0 -26
- package/.bob/cjs/normalize/capital-gains/securities.js +0 -58
- package/.bob/cjs/normalize/denormalize.d.ts +0 -42
- package/.bob/cjs/normalize/denormalize.js +0 -359
- package/.bob/cjs/normalize/derive.d.ts +0 -57
- package/.bob/cjs/normalize/derive.js +0 -111
- package/.bob/cjs/normalize/enums.d.ts +0 -58
- package/.bob/cjs/normalize/enums.js +0 -69
- package/.bob/cjs/normalize/fields.d.ts +0 -28
- package/.bob/cjs/normalize/fields.js +0 -86
- package/.bob/cjs/normalize/foreign.d.ts +0 -22
- package/.bob/cjs/normalize/foreign.js +0 -85
- package/.bob/cjs/normalize/main.d.ts +0 -24
- package/.bob/cjs/normalize/main.js +0 -208
- package/.bob/cjs/normalize/paths.d.ts +0 -74
- package/.bob/cjs/normalize/paths.js +0 -169
- package/.bob/cjs/normalize/phone.d.ts +0 -12
- package/.bob/cjs/normalize/phone.js +0 -35
- package/.bob/cjs/normalize/rd-investments.d.ts +0 -10
- package/.bob/cjs/normalize/rd-investments.js +0 -25
- package/.bob/cjs/normalize/related-companies.d.ts +0 -10
- package/.bob/cjs/normalize/related-companies.js +0 -25
- package/.bob/cjs/normalize/report.d.ts +0 -9
- package/.bob/cjs/normalize/report.js +0 -53
- package/.bob/cjs/normalize/shareholders.d.ts +0 -10
- package/.bob/cjs/normalize/shareholders.js +0 -30
- package/.bob/cjs/normalize/text.d.ts +0 -11
- package/.bob/cjs/normalize/text.js +0 -41
- package/.bob/cjs/normalize/today.d.ts +0 -4
- package/.bob/cjs/normalize/today.js +0 -14
- package/.bob/cjs/pipeline.d.ts +0 -13
- package/.bob/cjs/pipeline.js +0 -37
- package/.bob/cjs/response/codes.d.ts +0 -2
- package/.bob/cjs/response/codes.js +0 -31
- package/.bob/cjs/validate/capital-gains-rules.d.ts +0 -6
- package/.bob/cjs/validate/capital-gains-rules.js +0 -162
- package/.bob/cjs/validate/check-digit.d.ts +0 -10
- package/.bob/cjs/validate/check-digit.js +0 -26
- package/.bob/cjs/validate/engine.d.ts +0 -5
- package/.bob/cjs/validate/engine.js +0 -35
- package/.bob/cjs/validate/field-rules.d.ts +0 -4
- package/.bob/cjs/validate/field-rules.js +0 -331
- package/.bob/cjs/validate/foreign-rules.d.ts +0 -6
- package/.bob/cjs/validate/foreign-rules.js +0 -171
- package/.bob/cjs/validate/issue.d.ts +0 -51
- package/.bob/cjs/validate/issue.js +0 -78
- package/.bob/cjs/validate/main-rules.d.ts +0 -24
- package/.bob/cjs/validate/main-rules.js +0 -425
- package/.bob/cjs/validate/parse-rules.d.ts +0 -31
- package/.bob/cjs/validate/parse-rules.js +0 -114
- package/.bob/cjs/validate/rules.d.ts +0 -746
- package/.bob/cjs/validate/rules.js +0 -680
- package/.bob/cjs/validate/shape.d.ts +0 -19
- package/.bob/cjs/validate/shape.js +0 -231
- package/.bob/cjs/validate/shareholder-rules.d.ts +0 -6
- package/.bob/cjs/validate/shareholder-rules.js +0 -83
- package/.bob/cjs/validate/structure-rules.d.ts +0 -26
- package/.bob/cjs/validate/structure-rules.js +0 -130
- package/.bob/esm/api/generate.d.ts +0 -44
- package/.bob/esm/api/generate.js +0 -111
- package/.bob/esm/api/parse.d.ts +0 -28
- package/.bob/esm/api/parse.js +0 -34
- package/.bob/esm/api/response.d.ts +0 -24
- package/.bob/esm/api/response.js +0 -72
- package/.bob/esm/api/validate.d.ts +0 -16
- package/.bob/esm/api/validate.js +0 -11
- package/.bob/esm/codec/boolean.d.ts +0 -7
- package/.bob/esm/codec/boolean.js +0 -46
- package/.bob/esm/codec/date.d.ts +0 -6
- package/.bob/esm/codec/date.js +0 -64
- package/.bob/esm/codec/enum.d.ts +0 -4
- package/.bob/esm/codec/enum.js +0 -23
- package/.bob/esm/codec/numeric.d.ts +0 -56
- package/.bob/esm/codec/numeric.js +0 -175
- package/.bob/esm/codec/padding.d.ts +0 -10
- package/.bob/esm/codec/padding.js +0 -21
- package/.bob/esm/codec/percent.d.ts +0 -6
- package/.bob/esm/codec/percent.js +0 -30
- package/.bob/esm/codec/phone.d.ts +0 -4
- package/.bob/esm/codec/phone.js +0 -45
- package/.bob/esm/codec/record.d.ts +0 -18
- package/.bob/esm/codec/record.js +0 -172
- package/.bob/esm/codec/registry.d.ts +0 -8
- package/.bob/esm/codec/registry.js +0 -23
- package/.bob/esm/codec/sections.d.ts +0 -41
- package/.bob/esm/codec/sections.js +0 -170
- package/.bob/esm/codec/text.d.ts +0 -5
- package/.bob/esm/codec/text.js +0 -26
- package/.bob/esm/codec/types.d.ts +0 -36
- package/.bob/esm/codec/types.js +0 -12
- package/.bob/esm/codec/windows1255.d.ts +0 -9
- package/.bob/esm/codec/windows1255.js +0 -32
- package/.bob/esm/errors.d.ts +0 -32
- package/.bob/esm/errors.js +0 -94
- package/.bob/esm/file/assemble.d.ts +0 -17
- package/.bob/esm/file/assemble.js +0 -25
- package/.bob/esm/file/control.d.ts +0 -13
- package/.bob/esm/file/control.js +0 -41
- package/.bob/esm/file/parse.d.ts +0 -18
- package/.bob/esm/file/parse.js +0 -474
- package/.bob/esm/file/split.d.ts +0 -17
- package/.bob/esm/file/split.js +0 -68
- package/.bob/esm/index.d.ts +0 -16
- package/.bob/esm/index.js +0 -11
- package/.bob/esm/layout/2024/layout.generated.d.ts +0 -6919
- package/.bob/esm/layout/2024/layout.generated.js +0 -7221
- package/.bob/esm/layout/2025/index.d.ts +0 -6
- package/.bob/esm/layout/2025/index.js +0 -7
- package/.bob/esm/layout/capital-gains.d.ts +0 -9
- package/.bob/esm/layout/capital-gains.js +0 -11
- package/.bob/esm/layout/countries.d.ts +0 -5
- package/.bob/esm/layout/countries.js +0 -7
- package/.bob/esm/layout/freeze.d.ts +0 -5
- package/.bob/esm/layout/freeze.js +0 -13
- package/.bob/esm/layout/registry.d.ts +0 -10
- package/.bob/esm/layout/registry.js +0 -27
- package/.bob/esm/layout/types.d.ts +0 -82
- package/.bob/esm/layout/types.js +0 -32
- package/.bob/esm/model/codes.generated.d.ts +0 -48
- package/.bob/esm/model/codes.generated.js +0 -625
- package/.bob/esm/model/index.d.ts +0 -3
- package/.bob/esm/model/index.js +0 -2
- package/.bob/esm/model/input.d.ts +0 -543
- package/.bob/esm/model/input.js +0 -21
- package/.bob/esm/model/normalized.d.ts +0 -43
- package/.bob/esm/model/normalized.js +0 -0
- package/.bob/esm/model/options.d.ts +0 -14
- package/.bob/esm/model/options.js +0 -0
- package/.bob/esm/model/schema.d.ts +0 -594
- package/.bob/esm/model/schema.js +0 -335
- package/.bob/esm/normalize/canonical.d.ts +0 -13
- package/.bob/esm/normalize/canonical.js +0 -285
- package/.bob/esm/normalize/capital-gains/assets.d.ts +0 -37
- package/.bob/esm/normalize/capital-gains/assets.js +0 -87
- package/.bob/esm/normalize/capital-gains/index.d.ts +0 -61
- package/.bob/esm/normalize/capital-gains/index.js +0 -142
- package/.bob/esm/normalize/capital-gains/no-withholding.d.ts +0 -18
- package/.bob/esm/normalize/capital-gains/no-withholding.js +0 -31
- package/.bob/esm/normalize/capital-gains/other.d.ts +0 -54
- package/.bob/esm/normalize/capital-gains/other.js +0 -112
- package/.bob/esm/normalize/capital-gains/section6.d.ts +0 -7
- package/.bob/esm/normalize/capital-gains/section6.js +0 -9
- package/.bob/esm/normalize/capital-gains/securities.d.ts +0 -26
- package/.bob/esm/normalize/capital-gains/securities.js +0 -52
- package/.bob/esm/normalize/denormalize.d.ts +0 -42
- package/.bob/esm/normalize/denormalize.js +0 -354
- package/.bob/esm/normalize/derive.d.ts +0 -57
- package/.bob/esm/normalize/derive.js +0 -99
- package/.bob/esm/normalize/enums.d.ts +0 -58
- package/.bob/esm/normalize/enums.js +0 -64
- package/.bob/esm/normalize/fields.d.ts +0 -28
- package/.bob/esm/normalize/fields.js +0 -81
- package/.bob/esm/normalize/foreign.d.ts +0 -22
- package/.bob/esm/normalize/foreign.js +0 -81
- package/.bob/esm/normalize/main.d.ts +0 -24
- package/.bob/esm/normalize/main.js +0 -204
- package/.bob/esm/normalize/paths.d.ts +0 -74
- package/.bob/esm/normalize/paths.js +0 -161
- package/.bob/esm/normalize/phone.d.ts +0 -12
- package/.bob/esm/normalize/phone.js +0 -32
- package/.bob/esm/normalize/rd-investments.d.ts +0 -10
- package/.bob/esm/normalize/rd-investments.js +0 -22
- package/.bob/esm/normalize/related-companies.d.ts +0 -10
- package/.bob/esm/normalize/related-companies.js +0 -22
- package/.bob/esm/normalize/report.d.ts +0 -9
- package/.bob/esm/normalize/report.js +0 -50
- package/.bob/esm/normalize/shareholders.d.ts +0 -10
- package/.bob/esm/normalize/shareholders.js +0 -27
- package/.bob/esm/normalize/text.d.ts +0 -11
- package/.bob/esm/normalize/text.js +0 -37
- package/.bob/esm/normalize/today.d.ts +0 -4
- package/.bob/esm/normalize/today.js +0 -11
- package/.bob/esm/pipeline.d.ts +0 -13
- package/.bob/esm/pipeline.js +0 -34
- package/.bob/esm/response/codes.d.ts +0 -2
- package/.bob/esm/response/codes.js +0 -28
- package/.bob/esm/validate/capital-gains-rules.d.ts +0 -6
- package/.bob/esm/validate/capital-gains-rules.js +0 -159
- package/.bob/esm/validate/check-digit.d.ts +0 -10
- package/.bob/esm/validate/check-digit.js +0 -23
- package/.bob/esm/validate/engine.d.ts +0 -5
- package/.bob/esm/validate/engine.js +0 -32
- package/.bob/esm/validate/field-rules.d.ts +0 -4
- package/.bob/esm/validate/field-rules.js +0 -328
- package/.bob/esm/validate/foreign-rules.d.ts +0 -6
- package/.bob/esm/validate/foreign-rules.js +0 -168
- package/.bob/esm/validate/issue.d.ts +0 -51
- package/.bob/esm/validate/issue.js +0 -72
- package/.bob/esm/validate/main-rules.d.ts +0 -24
- package/.bob/esm/validate/main-rules.js +0 -420
- package/.bob/esm/validate/parse-rules.d.ts +0 -31
- package/.bob/esm/validate/parse-rules.js +0 -110
- package/.bob/esm/validate/rules.d.ts +0 -746
- package/.bob/esm/validate/rules.js +0 -676
- package/.bob/esm/validate/shape.d.ts +0 -19
- package/.bob/esm/validate/shape.js +0 -227
- package/.bob/esm/validate/shareholder-rules.d.ts +0 -6
- package/.bob/esm/validate/shareholder-rules.js +0 -80
- package/.bob/esm/validate/structure-rules.d.ts +0 -26
- package/.bob/esm/validate/structure-rules.js +0 -122
- package/.bob/tsconfig.tsbuildinfo +0 -1
- package/.gitattributes +0 -1
- package/CLAUDE.md +0 -39
- package/dist/cjs/index.js +0 -28
- package/dist/esm/index.js +0 -11
- package/documentation/IMPLEMENTATION_PLAN.md +0 -2258
- package/documentation/SPEC.md +0 -1803
- package/documentation/layout/2024/codes.csv +0 -261
- package/documentation/layout/2024/countries.csv +0 -256
- package/documentation/layout/2024/fields.csv +0 -271
- package/documentation/layout/2024/records.csv +0 -18
- package/documentation/layout/README.md +0 -87
- package/documentation/specifications/1214-2024.pdf +0 -0
- package/documentation/tools/extract_layout.py +0 -191
- package/scripts/generate-layout.ts +0 -23
- package/scripts/layout/csv.ts +0 -111
- package/scripts/layout/derived-codes.ts +0 -12
- package/scripts/layout/render.ts +0 -364
- package/scripts/layout/sources.ts +0 -51
- package/scripts/layout/values.ts +0 -42
- package/scripts/render-rules-table.ts +0 -66
- package/src/api/generate.ts +0 -169
- package/src/api/parse.ts +0 -58
- package/src/api/response.ts +0 -110
- package/src/api/validate.ts +0 -26
- package/src/codec/boolean.ts +0 -62
- package/src/codec/date.ts +0 -75
- package/src/codec/enum.ts +0 -28
- package/src/codec/numeric.ts +0 -208
- package/src/codec/padding.ts +0 -33
- package/src/codec/percent.ts +0 -35
- package/src/codec/phone.ts +0 -54
- package/src/codec/record.ts +0 -206
- package/src/codec/registry.ts +0 -27
- package/src/codec/sections.ts +0 -208
- package/src/codec/text.ts +0 -31
- package/src/codec/types.ts +0 -47
- package/src/codec/windows1255.ts +0 -38
- package/src/errors.ts +0 -114
- package/src/file/assemble.ts +0 -42
- package/src/file/control.ts +0 -59
- package/src/file/parse.ts +0 -620
- package/src/file/split.ts +0 -86
- package/src/index.ts +0 -70
- package/src/layout/2024/layout.generated.ts +0 -7238
- package/src/layout/2025/index.ts +0 -9
- package/src/layout/capital-gains.ts +0 -20
- package/src/layout/countries.ts +0 -7
- package/src/layout/freeze.ts +0 -13
- package/src/layout/registry.ts +0 -33
- package/src/layout/types.ts +0 -134
- package/src/model/codes.generated.ts +0 -1190
- package/src/model/index.ts +0 -4
- package/src/model/input.ts +0 -594
- package/src/model/normalized.ts +0 -38
- package/src/model/options.ts +0 -17
- package/src/model/schema.ts +0 -381
- package/src/normalize/canonical.ts +0 -374
- package/src/normalize/capital-gains/assets.ts +0 -112
- package/src/normalize/capital-gains/index.ts +0 -212
- package/src/normalize/capital-gains/no-withholding.ts +0 -46
- package/src/normalize/capital-gains/other.ts +0 -153
- package/src/normalize/capital-gains/section6.ts +0 -14
- package/src/normalize/capital-gains/securities.ts +0 -73
- package/src/normalize/denormalize.ts +0 -426
- package/src/normalize/derive.ts +0 -136
- package/src/normalize/enums.ts +0 -87
- package/src/normalize/fields.ts +0 -110
- package/src/normalize/foreign.ts +0 -114
- package/src/normalize/main.ts +0 -284
- package/src/normalize/paths.ts +0 -184
- package/src/normalize/phone.ts +0 -45
- package/src/normalize/rd-investments.ts +0 -38
- package/src/normalize/related-companies.ts +0 -37
- package/src/normalize/report.ts +0 -59
- package/src/normalize/shareholders.ts +0 -42
- package/src/normalize/text.ts +0 -40
- package/src/normalize/today.ts +0 -15
- package/src/pipeline.ts +0 -42
- package/src/response/codes.ts +0 -30
- package/src/validate/capital-gains-rules.ts +0 -199
- package/src/validate/check-digit.ts +0 -25
- package/src/validate/engine.ts +0 -45
- package/src/validate/field-rules.ts +0 -383
- package/src/validate/foreign-rules.ts +0 -274
- package/src/validate/issue.ts +0 -121
- package/src/validate/main-rules.ts +0 -678
- package/src/validate/parse-rules.ts +0 -169
- package/src/validate/rules.ts +0 -747
- package/src/validate/shape.ts +0 -278
- package/src/validate/shareholder-rules.ts +0 -92
- package/src/validate/structure-rules.ts +0 -136
- package/tests/api/batch.test.ts +0 -227
- package/tests/api/exports.test.ts +0 -355
- package/tests/api/generate.test.ts +0 -409
- package/tests/api/parse.test.ts +0 -789
- package/tests/api/response.test.ts +0 -152
- package/tests/api/validate.test.ts +0 -86
- package/tests/codec/numeric.test.ts +0 -325
- package/tests/codec/record.test.ts +0 -318
- package/tests/codec/registry.test.ts +0 -17
- package/tests/codec/sections.test.ts +0 -333
- package/tests/codec/text.test.ts +0 -454
- package/tests/codec/windows1255.test.ts +0 -46
- package/tests/docs/readme.test.ts +0 -69
- package/tests/edge-cases.test.ts +0 -359
- package/tests/errors.test.ts +0 -138
- package/tests/file/assemble.test.ts +0 -188
- package/tests/file/split.test.ts +0 -61
- package/tests/fixtures/builders.ts +0 -512
- package/tests/fixtures/files.ts +0 -78
- package/tests/fixtures/golden/README.md +0 -37
- package/tests/fixtures/golden/VERIFICATION.md +0 -72
- package/tests/fixtures/golden/batch-50.input.ts +0 -92
- package/tests/fixtures/golden/batch-50.opcn +0 -150
- package/tests/fixtures/golden/capital-gains-max.input.ts +0 -177
- package/tests/fixtures/golden/capital-gains-max.opcn +0 -17
- package/tests/fixtures/golden/cg-27.input.ts +0 -63
- package/tests/fixtures/golden/cg-27.opcn +0 -4
- package/tests/fixtures/golden/cg-50.input.ts +0 -59
- package/tests/fixtures/golden/cg-50.opcn +0 -4
- package/tests/fixtures/golden/cg-51.input.ts +0 -60
- package/tests/fixtures/golden/cg-51.opcn +0 -4
- package/tests/fixtures/golden/cg-54.input.ts +0 -53
- package/tests/fixtures/golden/cg-54.opcn +0 -4
- package/tests/fixtures/golden/cg-60.input.ts +0 -77
- package/tests/fixtures/golden/cg-60.opcn +0 -4
- package/tests/fixtures/golden/cg-63.input.ts +0 -51
- package/tests/fixtures/golden/cg-63.opcn +0 -4
- package/tests/fixtures/golden/cg-64.input.ts +0 -62
- package/tests/fixtures/golden/cg-64.opcn +0 -4
- package/tests/fixtures/golden/cg-65.input.ts +0 -79
- package/tests/fixtures/golden/cg-65.opcn +0 -4
- package/tests/fixtures/golden/cg-66.input.ts +0 -53
- package/tests/fixtures/golden/cg-66.opcn +0 -4
- package/tests/fixtures/golden/cg-77.input.ts +0 -109
- package/tests/fixtures/golden/cg-77.opcn +0 -4
- package/tests/fixtures/golden/foreign.input.ts +0 -202
- package/tests/fixtures/golden/foreign.opcn +0 -27
- package/tests/fixtures/golden/hebrew-edge.input.ts +0 -90
- package/tests/fixtures/golden/hebrew-edge.opcn +0 -8
- package/tests/fixtures/golden/kibbutz.input.ts +0 -31
- package/tests/fixtures/golden/kibbutz.opcn +0 -2
- package/tests/fixtures/golden/main-full.input.ts +0 -780
- package/tests/fixtures/golden/main-full.opcn +0 -101
- package/tests/fixtures/golden/minimal.input.ts +0 -37
- package/tests/fixtures/golden/minimal.opcn +0 -3
- package/tests/fixtures/golden/related-and-rd.input.ts +0 -59
- package/tests/fixtures/golden/related-and-rd.opcn +0 -11
- package/tests/fixtures/random.ts +0 -843
- package/tests/golden/fixtures.test.ts +0 -627
- package/tests/golden/golden.test.ts +0 -95
- package/tests/helpers/coverage.ts +0 -18
- package/tests/helpers/sample-values.ts +0 -114
- package/tests/layout/codegen-sync.test.ts +0 -19
- package/tests/layout/integrity.test.ts +0 -232
- package/tests/layout/registry.test.ts +0 -98
- package/tests/model/code-unions.test.ts +0 -91
- package/tests/model/schema.test.ts +0 -1031
- package/tests/normalize/canonical.test.ts +0 -728
- package/tests/normalize/capital-gains.test.ts +0 -1850
- package/tests/normalize/coverage.test.ts +0 -88
- package/tests/normalize/denormalize.test.ts +0 -318
- package/tests/normalize/enums.test.ts +0 -118
- package/tests/normalize/foreign.test.ts +0 -273
- package/tests/normalize/main.test.ts +0 -839
- package/tests/normalize/paths.test.ts +0 -257
- package/tests/normalize/rd-investments.test.ts +0 -99
- package/tests/normalize/related-companies.test.ts +0 -106
- package/tests/normalize/shareholders.test.ts +0 -117
- package/tests/normalize/text.test.ts +0 -86
- package/tests/pipeline.test.ts +0 -96
- package/tests/roundtrip/determinism.test.ts +0 -207
- package/tests/roundtrip/property.test.ts +0 -126
- package/tests/roundtrip/roundtrip.test.ts +0 -573
- package/tests/rules/cases.ts +0 -873
- package/tests/rules/rules.test.ts +0 -69
- package/tests/rules/spec-sync.test.ts +0 -80
- package/tests/scripts/csv.test.ts +0 -78
- package/tests/scripts/values.test.ts +0 -80
- package/tests/validate/capital-gains-rules.test.ts +0 -307
- package/tests/validate/check-digit.test.ts +0 -42
- package/tests/validate/field-rules.test.ts +0 -867
- package/tests/validate/foreign-rules.test.ts +0 -255
- package/tests/validate/issue.test.ts +0 -96
- package/tests/validate/main-rules.test.ts +0 -761
- package/tests/validate/parse-rules.test.ts +0 -293
- package/tests/validate/shareholder-rules.test.ts +0 -143
- package/tsconfig.json +0 -10
- package/tsconfig.typecheck.json +0 -9
- package/vitest.config.ts +0 -11
|
@@ -1,839 +0,0 @@
|
|
|
1
|
-
import { renderReport } from '../../src/file/assemble.js';
|
|
2
|
-
import { getLayout } from '../../src/layout/registry.js';
|
|
3
|
-
import type { PhonePrefix, Report1214Input } from '../../src/model/input.js';
|
|
4
|
-
import type { NormalizedRecord } from '../../src/model/normalized.js';
|
|
5
|
-
import { normalizeReport } from '../../src/normalize/report.js';
|
|
6
|
-
import { todayInJerusalem } from '../../src/normalize/today.js';
|
|
7
|
-
import { fullDeclarationsInput, fullMainInput, minimalInput } from '../fixtures/builders.js';
|
|
8
|
-
|
|
9
|
-
const LAYOUT = getLayout(2024);
|
|
10
|
-
const TODAY = '2024-06-30';
|
|
11
|
-
const OPTIONS = { today: () => TODAY };
|
|
12
|
-
|
|
13
|
-
function mainRecord(input = minimalInput(), options = OPTIONS): NormalizedRecord {
|
|
14
|
-
const record = normalizeReport(input, LAYOUT, options).records[0];
|
|
15
|
-
if (record?.recordType !== '1000') {
|
|
16
|
-
throw new Error('expected record 1000 first');
|
|
17
|
-
}
|
|
18
|
-
return record;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** The record 1000 line of `input`. */
|
|
22
|
-
function mainLine(input: Report1214Input): string {
|
|
23
|
-
const line = renderReport(normalizeReport(input, LAYOUT, OPTIONS)).lines[0];
|
|
24
|
-
if (line === undefined) {
|
|
25
|
-
throw new Error('expected a record 1000 line');
|
|
26
|
-
}
|
|
27
|
-
return line;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/** The `length` characters of `line` at the 1-based layout `position`. */
|
|
31
|
-
function at(line: string, position: number, length: number): string {
|
|
32
|
-
return line.slice(position - 1, position - 1 + length);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
describe('normalizeReport: record 1000 (skeleton)', () => {
|
|
36
|
-
it('produces one 1000 and one 1020 record, in that order, with no notices', () => {
|
|
37
|
-
const report = normalizeReport(minimalInput(), LAYOUT, OPTIONS);
|
|
38
|
-
expect(report.taxYear).toBe(2024);
|
|
39
|
-
expect(report.layout).toBe(LAYOUT);
|
|
40
|
-
expect(report.records.map(r => [r.recordType, r.index])).toEqual([
|
|
41
|
-
['1000', 0],
|
|
42
|
-
['1020', 0],
|
|
43
|
-
]);
|
|
44
|
-
expect(report.notices).toEqual([]);
|
|
45
|
-
expect(report.omittedZeroCodes).toEqual([]);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('defaults the layout to the one of input.taxYear', () => {
|
|
49
|
-
expect(normalizeReport(minimalInput(), undefined, OPTIONS).layout).toBe(LAYOUT);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('maps every 1000 key of the minimal input to its value and path', () => {
|
|
53
|
-
const record = mainRecord();
|
|
54
|
-
expect(record.values).toEqual({
|
|
55
|
-
taxYear: 2024,
|
|
56
|
-
'meta.softwareName': 'ACCOUNTER',
|
|
57
|
-
'meta.saveDate': TODAY,
|
|
58
|
-
'company.fileNumber': '514000009',
|
|
59
|
-
'company.registeredName': 'חברה לדוגמה בע"מ',
|
|
60
|
-
'company.mailingAddress': 'רחוב הרצל 1, תל אביב',
|
|
61
|
-
'company.businessAddress': 'רחוב הרצל 1, תל אביב',
|
|
62
|
-
'company.phone.prefix': '03',
|
|
63
|
-
'company.phone.number': '1234567',
|
|
64
|
-
hasForeignAppendix: false,
|
|
65
|
-
'declarations.hasCapitalGainsAppendix': false,
|
|
66
|
-
'declarations.hasTaxPlanningAction': false,
|
|
67
|
-
'declarations.hadRelatedPartyTransactions': false,
|
|
68
|
-
'declarations.controlsBodyOfPersons': false,
|
|
69
|
-
'declarations.holdsRightsInBodyOfPersons': false,
|
|
70
|
-
'declarations.appliesAccountingStandards': false,
|
|
71
|
-
'declarations.directorsReceivedOpinion': false,
|
|
72
|
-
'declarations.tookReportablePosition': false,
|
|
73
|
-
});
|
|
74
|
-
expect(record.paths).toEqual({
|
|
75
|
-
taxYear: 'taxYear',
|
|
76
|
-
'meta.softwareName': 'meta.softwareName',
|
|
77
|
-
'meta.saveDate': 'meta.saveDate',
|
|
78
|
-
'company.fileNumber': 'company.fileNumber',
|
|
79
|
-
'company.registeredName': 'company.registeredName',
|
|
80
|
-
'company.mailingAddress': 'company.mailingAddress',
|
|
81
|
-
'company.businessAddress': 'company.businessAddress',
|
|
82
|
-
'company.phone.prefix': 'company.phone.prefix',
|
|
83
|
-
'company.phone.number': 'company.phone.number',
|
|
84
|
-
hasForeignAppendix: '',
|
|
85
|
-
'declarations.hasCapitalGainsAppendix': 'declarations.hasCapitalGainsAppendix',
|
|
86
|
-
'declarations.hasTaxPlanningAction': 'declarations.hasTaxPlanningAction',
|
|
87
|
-
'declarations.hadRelatedPartyTransactions': 'declarations.hadRelatedPartyTransactions',
|
|
88
|
-
'declarations.controlsBodyOfPersons': 'declarations.controlsBodyOfPersons',
|
|
89
|
-
'declarations.holdsRightsInBodyOfPersons': 'declarations.holdsRightsInBodyOfPersons',
|
|
90
|
-
'declarations.appliesAccountingStandards': 'declarations.appliesAccountingStandards',
|
|
91
|
-
'declarations.directorsReceivedOpinion': 'declarations.directorsReceivedOpinion',
|
|
92
|
-
'declarations.tookReportablePosition': 'declarations.tookReportablePosition',
|
|
93
|
-
'code:018': 'amounts["018"]',
|
|
94
|
-
'code:072': 'amounts["072"]',
|
|
95
|
-
'code:081': 'amounts["081"]',
|
|
96
|
-
'code:094': 'amounts["094"]',
|
|
97
|
-
'code:263': 'amounts["263"]',
|
|
98
|
-
'code:273': '',
|
|
99
|
-
});
|
|
100
|
-
expect(record.codes).toEqual(
|
|
101
|
-
new Map([
|
|
102
|
-
['018', 4],
|
|
103
|
-
['072', 0],
|
|
104
|
-
['081', 1000],
|
|
105
|
-
['094', 0],
|
|
106
|
-
['263', 1],
|
|
107
|
-
['273', 9],
|
|
108
|
-
]),
|
|
109
|
-
);
|
|
110
|
-
expect(record.countries).toEqual([]);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('maps the optional company members, including the fax', () => {
|
|
114
|
-
const record = mainRecord(
|
|
115
|
-
minimalInput({
|
|
116
|
-
company: {
|
|
117
|
-
withholdingFileNumber: '914000005',
|
|
118
|
-
vatFileNumber: '514000009',
|
|
119
|
-
occupationDescription: 'ייעוץ',
|
|
120
|
-
booksAddress: 'רחוב יפו 2, ירושלים',
|
|
121
|
-
email: 'office@example.com',
|
|
122
|
-
fax: { prefix: '052', number: '7654321' },
|
|
123
|
-
},
|
|
124
|
-
}),
|
|
125
|
-
);
|
|
126
|
-
expect(record.values).toMatchObject({
|
|
127
|
-
'company.withholdingFileNumber': '914000005',
|
|
128
|
-
'company.vatFileNumber': '514000009',
|
|
129
|
-
'company.occupationDescription': 'ייעוץ',
|
|
130
|
-
'company.booksAddress': 'רחוב יפו 2, ירושלים',
|
|
131
|
-
'company.email': 'office@example.com',
|
|
132
|
-
'company.fax.prefix': '052',
|
|
133
|
-
'company.fax.number': '7654321',
|
|
134
|
-
});
|
|
135
|
-
expect(record.paths['company.fax.number']).toBe('company.fax.number');
|
|
136
|
-
expect(record.paths['company.withholdingFileNumber']).toBe('company.withholdingFileNumber');
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it('every key it sets is a field of record 1000 and has a path', () => {
|
|
140
|
-
const record = mainRecord(
|
|
141
|
-
minimalInput({ company: { email: 'a@b.co', fax: { prefix: '02', number: '1111111' } } }),
|
|
142
|
-
);
|
|
143
|
-
const keys = new Set(LAYOUT.records['1000'].fields.map(field => field.key));
|
|
144
|
-
for (const key of Object.keys(record.values)) {
|
|
145
|
-
expect(keys).toContain(key);
|
|
146
|
-
expect(record.paths).toHaveProperty([key]);
|
|
147
|
-
}
|
|
148
|
-
for (const code of record.codes.keys()) {
|
|
149
|
-
expect(record.paths).toHaveProperty([`code:${code}`]);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
describe('meta defaults (SPEC §7.4)', () => {
|
|
154
|
-
it("defaults softwareName to 'ACCOUNTER' and saveDate to options.today()", () => {
|
|
155
|
-
const record = mainRecord(minimalInput(), { today: () => '2025-01-02' });
|
|
156
|
-
expect(record.values['meta.softwareName']).toBe('ACCOUNTER');
|
|
157
|
-
expect(record.values['meta.saveDate']).toBe('2025-01-02');
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
it('takes meta values from the input when given', () => {
|
|
161
|
-
const record = mainRecord(
|
|
162
|
-
minimalInput({ meta: { softwareName: ' My Soft ', saveDate: '2024-05-01' } }),
|
|
163
|
-
);
|
|
164
|
-
expect(record.values['meta.softwareName']).toBe('My Soft');
|
|
165
|
-
expect(record.values['meta.saveDate']).toBe('2024-05-01');
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
it('defaults saveDate to today in Asia/Jerusalem when options.today is absent', () => {
|
|
169
|
-
vi.useFakeTimers();
|
|
170
|
-
try {
|
|
171
|
-
vi.setSystemTime(new Date('2024-03-15T22:30:00Z'));
|
|
172
|
-
const report = normalizeReport(minimalInput());
|
|
173
|
-
expect(report.records[0]?.values['meta.saveDate']).toBe('2024-03-16');
|
|
174
|
-
} finally {
|
|
175
|
-
vi.useRealTimers();
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
describe('todayInJerusalem', () => {
|
|
181
|
-
it.each([
|
|
182
|
-
// Winter (UTC+2)
|
|
183
|
-
['2024-03-15T21:59:59Z', '2024-03-15'],
|
|
184
|
-
['2024-03-15T22:00:00Z', '2024-03-16'],
|
|
185
|
-
// Summer (UTC+3)
|
|
186
|
-
['2024-07-01T20:59:59Z', '2024-07-01'],
|
|
187
|
-
['2024-07-01T21:00:00Z', '2024-07-02'],
|
|
188
|
-
// Around midnight UTC
|
|
189
|
-
['2024-12-31T23:59:59Z', '2025-01-01'],
|
|
190
|
-
['2025-01-01T00:00:00Z', '2025-01-01'],
|
|
191
|
-
['2024-06-30T23:59:59Z', '2024-07-01'],
|
|
192
|
-
])('%s → %s', (instant, expected) => {
|
|
193
|
-
expect(todayInJerusalem(new Date(instant))).toBe(expected);
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
it('defaults to the current time', () => {
|
|
197
|
-
vi.useFakeTimers();
|
|
198
|
-
try {
|
|
199
|
-
vi.setSystemTime(new Date('2024-07-01T21:00:00Z'));
|
|
200
|
-
expect(todayInJerusalem()).toBe('2024-07-02');
|
|
201
|
-
} finally {
|
|
202
|
-
vi.useRealTimers();
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
describe('text normalization (SPEC §4.3)', () => {
|
|
208
|
-
it('passes text fields through normalizeText', () => {
|
|
209
|
-
const record = mainRecord(
|
|
210
|
-
minimalInput({
|
|
211
|
-
company: {
|
|
212
|
-
registeredName: ' חברה\u00A0 לדוגמה\u200F בע\u201Dמ ',
|
|
213
|
-
mailingAddress: 'רחוב\tהרצל 1 \u2013 תל אביב',
|
|
214
|
-
},
|
|
215
|
-
}),
|
|
216
|
-
);
|
|
217
|
-
expect(record.values['company.registeredName']).toBe('חברה לדוגמה בע"מ');
|
|
218
|
-
expect(record.values['company.mailingAddress']).toBe('רחוב הרצל 1 - תל אביב');
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
it('treats text that is empty after normalization as absent (SPEC §4.1)', () => {
|
|
222
|
-
const record = mainRecord(minimalInput({ company: { email: ' \u200E ', booksAddress: '' } }));
|
|
223
|
-
expect(record.values).not.toHaveProperty(['company.email']);
|
|
224
|
-
expect(record.values).not.toHaveProperty(['company.booksAddress']);
|
|
225
|
-
expect(record.paths).not.toHaveProperty(['company.email']);
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
describe('digit strings', () => {
|
|
230
|
-
it('keeps a digit string that is not all digits as-is (rules report it)', () => {
|
|
231
|
-
const record = mainRecord(minimalInput({ company: { fileNumber: '12a' } }));
|
|
232
|
-
expect(record.values['company.fileNumber']).toBe('12a');
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
it('keeps phone numbers as digit strings with their leading zeros', () => {
|
|
236
|
-
const record = mainRecord(minimalInput({ company: { phone: { number: '0123456' } } }));
|
|
237
|
-
expect(record.values['company.phone.number']).toBe('0123456');
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
describe('derived values (SPEC §7.4)', () => {
|
|
242
|
-
it('832 and 833 are "no" while no appendix exists', () => {
|
|
243
|
-
const record = mainRecord();
|
|
244
|
-
expect(record.values.hasForeignAppendix).toBe(false);
|
|
245
|
-
expect(record.values['declarations.hasCapitalGainsAppendix']).toBe(false);
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
it('832 is "yes" when a foreign appendix exists', () => {
|
|
249
|
-
const record = mainRecord(
|
|
250
|
-
minimalInput({ foreignAppendix: { taxRefundDeclaration: false, amounts: {} } }),
|
|
251
|
-
);
|
|
252
|
-
expect(record.values.hasForeignAppendix).toBe(true);
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
it.each([
|
|
256
|
-
[true, false, 1],
|
|
257
|
-
[false, true, 2],
|
|
258
|
-
[true, true, 3],
|
|
259
|
-
[false, false, 9],
|
|
260
|
-
])(
|
|
261
|
-
'code 273: directorsReceivedOpinion %s, tookReportablePosition %s → %i',
|
|
262
|
-
(directorsReceivedOpinion, tookReportablePosition, expected) => {
|
|
263
|
-
const record = mainRecord(
|
|
264
|
-
minimalInput({ declarations: { directorsReceivedOpinion, tookReportablePosition } }),
|
|
265
|
-
);
|
|
266
|
-
expect(record.codes.get('273')).toBe(expected);
|
|
267
|
-
expect(record.values['declarations.directorsReceivedOpinion']).toBe(
|
|
268
|
-
directorsReceivedOpinion,
|
|
269
|
-
);
|
|
270
|
-
expect(record.values['declarations.tookReportablePosition']).toBe(tookReportablePosition);
|
|
271
|
-
expect(record.paths['code:273']).toBe('');
|
|
272
|
-
},
|
|
273
|
-
);
|
|
274
|
-
|
|
275
|
-
it('code 008 = 1 when appliesAccountingStandards', () => {
|
|
276
|
-
const record = mainRecord(
|
|
277
|
-
minimalInput({ declarations: { appliesAccountingStandards: true } }),
|
|
278
|
-
);
|
|
279
|
-
expect(record.codes.get('008')).toBe(1);
|
|
280
|
-
expect(record.paths['code:008']).toBe('');
|
|
281
|
-
expect(record.values['declarations.appliesAccountingStandards']).toBe(true);
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
it('code 008 is omitted when not appliesAccountingStandards', () => {
|
|
285
|
-
expect(mainRecord().codes.has('008')).toBe(false);
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
describe('amounts (SPEC §4.5)', () => {
|
|
290
|
-
it('omits a zero for a code that is not zeroAllowed and lists it in omittedZeroCodes', () => {
|
|
291
|
-
const report = normalizeReport(
|
|
292
|
-
minimalInput({ amounts: { '010': 0, '070': 0, '020': 5 } }),
|
|
293
|
-
LAYOUT,
|
|
294
|
-
OPTIONS,
|
|
295
|
-
);
|
|
296
|
-
const record = report.records[0];
|
|
297
|
-
expect(record?.codes.has('010')).toBe(false);
|
|
298
|
-
expect(record?.codes.has('070')).toBe(false);
|
|
299
|
-
expect(record?.paths).not.toHaveProperty(['code:010']);
|
|
300
|
-
expect(record?.codes.get('020')).toBe(5);
|
|
301
|
-
expect(record?.paths['code:020']).toBe('amounts["020"]');
|
|
302
|
-
expect(report.omittedZeroCodes).toEqual([
|
|
303
|
-
{ record: '1000', recordIndex: 0, code: '010' },
|
|
304
|
-
{ record: '1000', recordIndex: 0, code: '070' },
|
|
305
|
-
]);
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
it('keeps a zero for a zeroAllowed code', () => {
|
|
309
|
-
const record = mainRecord(minimalInput({ amounts: { '072': 0, '121': 0 } }));
|
|
310
|
-
expect(record.codes.get('072')).toBe(0);
|
|
311
|
-
expect(record.codes.get('121')).toBe(0);
|
|
312
|
-
expect(record.paths['code:072']).toBe('amounts["072"]');
|
|
313
|
-
expect(record.paths['code:121']).toBe('amounts["121"]');
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
it('skips codes whose value is undefined', () => {
|
|
317
|
-
const record = mainRecord(minimalInput({ amounts: { '010': undefined } }));
|
|
318
|
-
expect(record.codes.has('010')).toBe(false);
|
|
319
|
-
});
|
|
320
|
-
|
|
321
|
-
it('keeps codes in ascending code order', () => {
|
|
322
|
-
const record = mainRecord(minimalInput({ amounts: { '299': 7, '010': 3 } }));
|
|
323
|
-
const codes = [...record.codes.keys()];
|
|
324
|
-
expect(codes).toEqual([...codes].sort());
|
|
325
|
-
});
|
|
326
|
-
});
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
describe('normalizeReport: record 1000 declarations and preparer', () => {
|
|
330
|
-
it('maps the preparer (1000@563–831) to its keys, encoded values and paths', () => {
|
|
331
|
-
const input = fullDeclarationsInput();
|
|
332
|
-
const record = mainRecord(input);
|
|
333
|
-
const line = mainLine(input);
|
|
334
|
-
const expected: Array<[string, unknown, number, string]> = [
|
|
335
|
-
['preparer.officeName', 'משרד רואי חשבון', 563, 'משרד רואי חשבון'.padStart(50)],
|
|
336
|
-
['preparer.contactName', 'דנה כהן', 613, 'דנה כהן'.padStart(50)],
|
|
337
|
-
['preparer.name', 'יוסי לוי', 663, 'יוסי לוי'.padStart(50)],
|
|
338
|
-
['preparer.profession', 'רואה חשבון', 713, 'רואה חשבון'.padStart(50)],
|
|
339
|
-
['preparer.licensedDealerNumber', '012345674', 763, '012345674'],
|
|
340
|
-
['preparer.address', 'רחוב יפו 10, ירושלים', 772, 'רחוב יפו 10, ירושלים'.padStart(50)],
|
|
341
|
-
// 822 is a numeric prefix field: zero-padded (SPEC §15 A-19).
|
|
342
|
-
['preparer.phone.prefix', '02', 822, '002'],
|
|
343
|
-
['preparer.phone.number', '6543210', 825, '6543210'],
|
|
344
|
-
];
|
|
345
|
-
for (const [key, value, position, encoded] of expected) {
|
|
346
|
-
expect(record.values[key]).toBe(value);
|
|
347
|
-
expect(record.paths[key]).toBe(key);
|
|
348
|
-
expect(at(line, position, encoded.length)).toBe(encoded);
|
|
349
|
-
}
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
it('normalizes preparer text and drops an invalid preparer phone prefix with a notice', () => {
|
|
353
|
-
const report = normalizeReport(
|
|
354
|
-
fullDeclarationsInput({
|
|
355
|
-
preparer: { name: ' יוסי\u00A0 לוי ', phone: { prefix: '01' as PhonePrefix } },
|
|
356
|
-
}),
|
|
357
|
-
LAYOUT,
|
|
358
|
-
OPTIONS,
|
|
359
|
-
);
|
|
360
|
-
const record = report.records[0];
|
|
361
|
-
expect(record?.values['preparer.name']).toBe('יוסי לוי');
|
|
362
|
-
expect(record?.values).not.toHaveProperty(['preparer.phone.prefix']);
|
|
363
|
-
expect(record?.values['preparer.phone.number']).toBe('6543210');
|
|
364
|
-
expect(report.notices).toEqual([
|
|
365
|
-
expect.objectContaining({
|
|
366
|
-
ruleId: 'field.phonePrefix',
|
|
367
|
-
severity: 'warning',
|
|
368
|
-
path: 'preparer.phone.prefix',
|
|
369
|
-
value: '01',
|
|
370
|
-
}),
|
|
371
|
-
]);
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
it('leaves every preparer field absent without a preparer', () => {
|
|
375
|
-
const record = mainRecord();
|
|
376
|
-
expect(Object.keys(record.values).filter(key => key.startsWith('preparer.'))).toEqual([]);
|
|
377
|
-
const line = mainLine(minimalInput());
|
|
378
|
-
expect(at(line, 763, 9)).toBe('000000000');
|
|
379
|
-
expect(at(line, 822, 3)).toBe('000');
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
it.each([
|
|
383
|
-
['obliged', 1],
|
|
384
|
-
['notObliged', 2],
|
|
385
|
-
['notRelevant', 3],
|
|
386
|
-
] as const)('form6111Obligation %s → 834 = %i', (form6111Obligation, code) => {
|
|
387
|
-
const input = minimalInput({ declarations: { form6111Obligation } });
|
|
388
|
-
const record = mainRecord(input);
|
|
389
|
-
expect(record.values['declarations.form6111Obligation']).toBe(code);
|
|
390
|
-
expect(record.paths['declarations.form6111Obligation']).toBe('declarations.form6111Obligation');
|
|
391
|
-
expect(at(mainLine(input), 834, 1)).toBe(String(code));
|
|
392
|
-
});
|
|
393
|
-
|
|
394
|
-
it.each([
|
|
395
|
-
['consolidatedUnderSection23', 1],
|
|
396
|
-
['consolidatesWithParent', 2],
|
|
397
|
-
['notRelevant', 3],
|
|
398
|
-
] as const)('consolidatedReport %s → 875 = %i', (consolidatedReport, code) => {
|
|
399
|
-
const input = minimalInput({ declarations: { consolidatedReport } });
|
|
400
|
-
const record = mainRecord(input);
|
|
401
|
-
expect(record.values['declarations.consolidatedReport']).toBe(code);
|
|
402
|
-
expect(record.paths['declarations.consolidatedReport']).toBe('declarations.consolidatedReport');
|
|
403
|
-
expect(at(mainLine(input), 875, 1)).toBe(String(code));
|
|
404
|
-
});
|
|
405
|
-
|
|
406
|
-
it('writes 0 for an absent enum declaration', () => {
|
|
407
|
-
const line = mainLine(minimalInput());
|
|
408
|
-
expect(at(line, 834, 1)).toBe('0');
|
|
409
|
-
expect(at(line, 875, 1)).toBe('0');
|
|
410
|
-
});
|
|
411
|
-
|
|
412
|
-
it('keeps an enum value that is not one of its literals as-is, for the field rules', () => {
|
|
413
|
-
const record = mainRecord(
|
|
414
|
-
minimalInput({ declarations: { form6111Obligation: 'sometimes' as 'obliged' } }),
|
|
415
|
-
);
|
|
416
|
-
expect(record.values['declarations.form6111Obligation']).toBe('sometimes');
|
|
417
|
-
});
|
|
418
|
-
|
|
419
|
-
it('familyCompany → 836 = 1 and 837 = representativeFileNumber', () => {
|
|
420
|
-
const input = minimalInput({
|
|
421
|
-
declarations: { familyCompany: { representativeFileNumber: '300000007' } },
|
|
422
|
-
});
|
|
423
|
-
const record = mainRecord(input);
|
|
424
|
-
const line = mainLine(input);
|
|
425
|
-
expect(record.values['declarations.familyCompany.isFamilyCompany']).toBe(true);
|
|
426
|
-
expect(record.paths['declarations.familyCompany.isFamilyCompany']).toBe(
|
|
427
|
-
'declarations.familyCompany',
|
|
428
|
-
);
|
|
429
|
-
expect(record.values['declarations.familyCompany.representativeFileNumber']).toBe('300000007');
|
|
430
|
-
expect(record.paths['declarations.familyCompany.representativeFileNumber']).toBe(
|
|
431
|
-
'declarations.familyCompany.representativeFileNumber',
|
|
432
|
-
);
|
|
433
|
-
expect(at(line, 836, 1)).toBe('1');
|
|
434
|
-
expect(at(line, 837, 9)).toBe('300000007');
|
|
435
|
-
});
|
|
436
|
-
|
|
437
|
-
it('beneficiaryEnterprise → 851 = 1 and 852 = the notice date', () => {
|
|
438
|
-
const input = minimalInput({
|
|
439
|
-
declarations: { beneficiaryEnterprise: { noticeDate: '2023-05-14' } },
|
|
440
|
-
});
|
|
441
|
-
const record = mainRecord(input);
|
|
442
|
-
const line = mainLine(input);
|
|
443
|
-
expect(record.values['declarations.beneficiaryEnterprise.marked']).toBe(true);
|
|
444
|
-
expect(record.paths['declarations.beneficiaryEnterprise.marked']).toBe(
|
|
445
|
-
'declarations.beneficiaryEnterprise',
|
|
446
|
-
);
|
|
447
|
-
expect(record.values['declarations.beneficiaryEnterprise.noticeDate']).toBe('2023-05-14');
|
|
448
|
-
expect(record.paths['declarations.beneficiaryEnterprise.noticeDate']).toBe(
|
|
449
|
-
'declarations.beneficiaryEnterprise.noticeDate',
|
|
450
|
-
);
|
|
451
|
-
expect(at(line, 851, 1)).toBe('1');
|
|
452
|
-
expect(at(line, 852, 10)).toBe('14/05/2023');
|
|
453
|
-
});
|
|
454
|
-
|
|
455
|
-
it('specialYear → 863 = 1 and 864 = the balance sheet date', () => {
|
|
456
|
-
const input = minimalInput({
|
|
457
|
-
declarations: { specialYear: { balanceSheetDate: '2024-09-30' } },
|
|
458
|
-
});
|
|
459
|
-
const record = mainRecord(input);
|
|
460
|
-
const line = mainLine(input);
|
|
461
|
-
expect(record.values['declarations.specialYear.marked']).toBe(true);
|
|
462
|
-
expect(record.paths['declarations.specialYear.marked']).toBe('declarations.specialYear');
|
|
463
|
-
expect(record.values['declarations.specialYear.balanceSheetDate']).toBe('2024-09-30');
|
|
464
|
-
expect(record.paths['declarations.specialYear.balanceSheetDate']).toBe(
|
|
465
|
-
'declarations.specialYear.balanceSheetDate',
|
|
466
|
-
);
|
|
467
|
-
expect(at(line, 863, 1)).toBe('1');
|
|
468
|
-
expect(at(line, 864, 10)).toBe('30/09/2024');
|
|
469
|
-
});
|
|
470
|
-
|
|
471
|
-
it('leaves the presence flags unmarked without their objects', () => {
|
|
472
|
-
const record = mainRecord();
|
|
473
|
-
const line = mainLine(minimalInput());
|
|
474
|
-
for (const key of [
|
|
475
|
-
'declarations.familyCompany.isFamilyCompany',
|
|
476
|
-
'declarations.familyCompany.representativeFileNumber',
|
|
477
|
-
'declarations.beneficiaryEnterprise.marked',
|
|
478
|
-
'declarations.beneficiaryEnterprise.noticeDate',
|
|
479
|
-
'declarations.specialYear.marked',
|
|
480
|
-
'declarations.specialYear.balanceSheetDate',
|
|
481
|
-
]) {
|
|
482
|
-
expect(record.values).not.toHaveProperty([key]);
|
|
483
|
-
}
|
|
484
|
-
expect(at(line, 836, 10)).toBe('0000000000');
|
|
485
|
-
expect(at(line, 851, 1)).toBe('0');
|
|
486
|
-
expect(at(line, 852, 10)).toBe(' '.repeat(10));
|
|
487
|
-
expect(at(line, 863, 1)).toBe('0');
|
|
488
|
-
expect(at(line, 864, 10)).toBe(' '.repeat(10));
|
|
489
|
-
});
|
|
490
|
-
|
|
491
|
-
it('reportablePositions [12, 7] → 1034 = 012, 1037 = 007, 1040–1046 = 000', () => {
|
|
492
|
-
const input = minimalInput({
|
|
493
|
-
declarations: { tookReportablePosition: true, reportablePositions: [12, 7] },
|
|
494
|
-
});
|
|
495
|
-
const record = mainRecord(input);
|
|
496
|
-
const line = mainLine(input);
|
|
497
|
-
expect(record.values['declarations.reportablePositions[0]']).toBe(12);
|
|
498
|
-
expect(record.values['declarations.reportablePositions[1]']).toBe(7);
|
|
499
|
-
expect(record.values).not.toHaveProperty(['declarations.reportablePositions[2]']);
|
|
500
|
-
expect(record.paths['declarations.reportablePositions[0]']).toBe(
|
|
501
|
-
'declarations.reportablePositions[0]',
|
|
502
|
-
);
|
|
503
|
-
expect(record.paths['declarations.reportablePositions[1]']).toBe(
|
|
504
|
-
'declarations.reportablePositions[1]',
|
|
505
|
-
);
|
|
506
|
-
expect(at(line, 1034, 3)).toBe('012');
|
|
507
|
-
expect(at(line, 1037, 3)).toBe('007');
|
|
508
|
-
expect(at(line, 1040, 3)).toBe('000');
|
|
509
|
-
expect(at(line, 1043, 3)).toBe('000');
|
|
510
|
-
expect(at(line, 1046, 3)).toBe('000');
|
|
511
|
-
});
|
|
512
|
-
|
|
513
|
-
it('writes only the first five reportable positions and raises a notice for the sixth', () => {
|
|
514
|
-
const input = minimalInput({
|
|
515
|
-
declarations: { tookReportablePosition: true, reportablePositions: [1, 2, 3, 4, 5, 6] },
|
|
516
|
-
});
|
|
517
|
-
expect(normalizeReport(input, LAYOUT, OPTIONS).notices).toEqual([
|
|
518
|
-
expect.objectContaining({
|
|
519
|
-
ruleId: 'main.reportablePositions.max',
|
|
520
|
-
severity: 'error',
|
|
521
|
-
path: 'declarations.reportablePositions[5]',
|
|
522
|
-
value: 6,
|
|
523
|
-
}),
|
|
524
|
-
]);
|
|
525
|
-
const record = mainRecord(input);
|
|
526
|
-
expect(
|
|
527
|
-
Object.keys(record.values).filter(key => key.startsWith('declarations.reportablePositions')),
|
|
528
|
-
).toHaveLength(5);
|
|
529
|
-
expect(at(mainLine(input), 1034, 15)).toBe('001002003004005');
|
|
530
|
-
});
|
|
531
|
-
|
|
532
|
-
it.each([
|
|
533
|
-
['requestsAdvancePayments', 883],
|
|
534
|
-
['hasBuildingIncome', 884],
|
|
535
|
-
['partOfMultinationalGroup', 1033],
|
|
536
|
-
] as const)('%s is yes/no at %i: 1, 2, and 0 when absent', (member, position) => {
|
|
537
|
-
const key = `declarations.${member}`;
|
|
538
|
-
for (const [value, encoded] of [
|
|
539
|
-
[true, '1'],
|
|
540
|
-
[false, '2'],
|
|
541
|
-
[undefined, '0'],
|
|
542
|
-
] as const) {
|
|
543
|
-
const input = minimalInput({ declarations: { [member]: value } });
|
|
544
|
-
const record = mainRecord(input);
|
|
545
|
-
expect(record.values[key]).toBe(value);
|
|
546
|
-
expect(record.paths[key]).toBe(value === undefined ? undefined : key);
|
|
547
|
-
expect(at(mainLine(input), position, 1)).toBe(encoded);
|
|
548
|
-
}
|
|
549
|
-
});
|
|
550
|
-
|
|
551
|
-
it.each([
|
|
552
|
-
['financialStatementsAttached', 835],
|
|
553
|
-
['isHouseCompany', 846],
|
|
554
|
-
['form1343Attached', 847],
|
|
555
|
-
['form1344Attached', 848],
|
|
556
|
-
['claimsCapitalInvestmentLawBenefits', 849],
|
|
557
|
-
['preferredEnterprise', 850],
|
|
558
|
-
['dividendDistributed', 862],
|
|
559
|
-
['foreignInvestors', 874],
|
|
560
|
-
['partnerInPartnership', 876],
|
|
561
|
-
['isKibbutz', 877],
|
|
562
|
-
['isTrustBeneficiary', 886],
|
|
563
|
-
['nonDeductibleSalaryExpenses', 1031],
|
|
564
|
-
['fewMembersCompany62A', 1032],
|
|
565
|
-
['noBankAccount', 1064],
|
|
566
|
-
] as const)('%s is a flag at %i: 1 when marked, 0 otherwise', (member, position) => {
|
|
567
|
-
const key = `declarations.${member}`;
|
|
568
|
-
const marked = minimalInput({ declarations: { [member]: true } });
|
|
569
|
-
expect(mainRecord(marked).values[key]).toBe(true);
|
|
570
|
-
expect(mainRecord(marked).paths[key]).toBe(key);
|
|
571
|
-
expect(at(mainLine(marked), position, 1)).toBe('1');
|
|
572
|
-
expect(at(mainLine(minimalInput({ declarations: { [member]: false } })), position, 1)).toBe(
|
|
573
|
-
'0',
|
|
574
|
-
);
|
|
575
|
-
expect(at(mainLine(minimalInput()), position, 1)).toBe('0');
|
|
576
|
-
});
|
|
577
|
-
|
|
578
|
-
describe('833 has capital-gains appendix (SPEC §7.4)', () => {
|
|
579
|
-
it('hasCapitalGainsAppendix true forces 833 = yes', () => {
|
|
580
|
-
const input = minimalInput({ declarations: { hasCapitalGainsAppendix: true } });
|
|
581
|
-
const record = mainRecord(input);
|
|
582
|
-
expect(record.values['declarations.hasCapitalGainsAppendix']).toBe(true);
|
|
583
|
-
expect(record.paths['declarations.hasCapitalGainsAppendix']).toBe(
|
|
584
|
-
'declarations.hasCapitalGainsAppendix',
|
|
585
|
-
);
|
|
586
|
-
expect(at(mainLine(input), 833, 1)).toBe('1');
|
|
587
|
-
});
|
|
588
|
-
|
|
589
|
-
it.each([false, undefined])('hasCapitalGainsAppendix %s leaves 833 derived (no)', value => {
|
|
590
|
-
const input = minimalInput({ declarations: { hasCapitalGainsAppendix: value } });
|
|
591
|
-
expect(mainRecord(input).values['declarations.hasCapitalGainsAppendix']).toBe(false);
|
|
592
|
-
expect(at(mainLine(input), 833, 1)).toBe('2');
|
|
593
|
-
});
|
|
594
|
-
});
|
|
595
|
-
|
|
596
|
-
it('raises no notices for the full declarations input', () => {
|
|
597
|
-
expect(normalizeReport(fullDeclarationsInput(), LAYOUT, OPTIONS).notices).toEqual([]);
|
|
598
|
-
});
|
|
599
|
-
});
|
|
600
|
-
|
|
601
|
-
describe('normalizeReport: record 1000 other income, attachments, capital-gains summary, qualifying company', () => {
|
|
602
|
-
it('maps every member to its key, encoded value and path', () => {
|
|
603
|
-
const input = fullMainInput();
|
|
604
|
-
const record = mainRecord(input);
|
|
605
|
-
const line = mainLine(input);
|
|
606
|
-
const expected: Array<[string, unknown, number, string]> = [
|
|
607
|
-
['otherTaxableIncome.source', 'דמי שכירות', 887, 'דמי שכירות'.padStart(50)],
|
|
608
|
-
['otherTaxableIncome.amount', 25_000, 937, '000000025000'],
|
|
609
|
-
// percentX100: × 100 with alphanumeric padding (SPEC §15 A-2).
|
|
610
|
-
['otherTaxableIncome.ratePercent', 10.23, 949, ' 1023'],
|
|
611
|
-
['attachments.donationReceiptsCount', 2, 954, '002'],
|
|
612
|
-
['attachments.withholdingCertificatesCount', 3, 957, '003'],
|
|
613
|
-
['capitalGainsSummary.totalAppendicesCount', 4, 960, '04'],
|
|
614
|
-
['capitalGainsSummary.untransmittedCount', 3, 962, '03'],
|
|
615
|
-
['capitalGainsSummary.reasons.lossOrNoGain', true, 964, '1'],
|
|
616
|
-
['capitalGainsSummary.reasons.overFiveImprovementBalances', true, 965, '1'],
|
|
617
|
-
['capitalGainsSummary.reasons.over14Appendices', true, 966, '1'],
|
|
618
|
-
['capitalGainsSummary.reasons.other', true, 967, '1'],
|
|
619
|
-
['capitalGainsSummary.reasons.otherText', 'העסקה בוטלה', 968, 'העסקה בוטלה'.padStart(50)],
|
|
620
|
-
['qualifyingCompany.purchased', true, 1065, '1'],
|
|
621
|
-
['qualifyingCompany.israeliPurchaseAmount', 1_000_000, 1066, '000001000000'],
|
|
622
|
-
['qualifyingCompany.foreignPurchaseAmount', 2_500_000, 1078, '000002500000'],
|
|
623
|
-
['qualifyingCompany.amortizationClaimed', true, 1090, '1'],
|
|
624
|
-
// amountX: digits with alphanumeric padding (SPEC §15 A-21).
|
|
625
|
-
['qualifyingCompany.amortizationAmount', 150_000, 1091, '150000'.padStart(12)],
|
|
626
|
-
];
|
|
627
|
-
for (const [key, value, position, encoded] of expected) {
|
|
628
|
-
expect(record.values[key]).toBe(value);
|
|
629
|
-
expect(record.paths[key]).toBe(key);
|
|
630
|
-
expect(at(line, position, encoded.length)).toBe(encoded);
|
|
631
|
-
}
|
|
632
|
-
});
|
|
633
|
-
|
|
634
|
-
it('otherTaxableIncome.ratePercent 10.23 → 949 = " 1023", 100 → "10000"', () => {
|
|
635
|
-
expect(at(mainLine(minimalInput({ otherTaxableIncome: { ratePercent: 10.23 } })), 949, 5)).toBe(
|
|
636
|
-
' 1023',
|
|
637
|
-
);
|
|
638
|
-
expect(at(mainLine(minimalInput({ otherTaxableIncome: { ratePercent: 100 } })), 949, 5)).toBe(
|
|
639
|
-
'10000',
|
|
640
|
-
);
|
|
641
|
-
});
|
|
642
|
-
|
|
643
|
-
it('normalizes the text members', () => {
|
|
644
|
-
const record = mainRecord(
|
|
645
|
-
minimalInput({
|
|
646
|
-
otherTaxableIncome: { source: ' דמי\u00A0 שכירות ' },
|
|
647
|
-
capitalGainsSummary: { reasons: { other: true, otherText: ' ' } },
|
|
648
|
-
}),
|
|
649
|
-
);
|
|
650
|
-
expect(record.values['otherTaxableIncome.source']).toBe('דמי שכירות');
|
|
651
|
-
expect(record.values).not.toHaveProperty(['capitalGainsSummary.reasons.otherText']);
|
|
652
|
-
});
|
|
653
|
-
|
|
654
|
-
it('qualifyingCompany.amortizationAmount 0 is kept and written as "0" (SPEC §15 A-21)', () => {
|
|
655
|
-
const input = minimalInput({
|
|
656
|
-
qualifyingCompany: { amortizationClaimed: true, amortizationAmount: 0 },
|
|
657
|
-
});
|
|
658
|
-
const record = mainRecord(input);
|
|
659
|
-
expect(record.values['qualifyingCompany.amortizationAmount']).toBe(0);
|
|
660
|
-
expect(record.paths['qualifyingCompany.amortizationAmount']).toBe(
|
|
661
|
-
'qualifyingCompany.amortizationAmount',
|
|
662
|
-
);
|
|
663
|
-
expect(at(mainLine(input), 1091, 12)).toBe('0'.padStart(12));
|
|
664
|
-
});
|
|
665
|
-
|
|
666
|
-
it.each([
|
|
667
|
-
['purchased', 1065],
|
|
668
|
-
['amortizationClaimed', 1090],
|
|
669
|
-
] as const)(
|
|
670
|
-
'qualifyingCompany.%s is yes/no at %i: 1, 2, and 0 when absent',
|
|
671
|
-
(member, position) => {
|
|
672
|
-
const key = `qualifyingCompany.${member}`;
|
|
673
|
-
for (const [value, encoded] of [
|
|
674
|
-
[true, '1'],
|
|
675
|
-
[false, '2'],
|
|
676
|
-
[undefined, '0'],
|
|
677
|
-
] as const) {
|
|
678
|
-
const input = minimalInput({ qualifyingCompany: { [member]: value } });
|
|
679
|
-
const record = mainRecord(input);
|
|
680
|
-
expect(record.values[key]).toBe(value);
|
|
681
|
-
expect(record.paths[key]).toBe(value === undefined ? undefined : key);
|
|
682
|
-
expect(at(mainLine(input), position, 1)).toBe(encoded);
|
|
683
|
-
}
|
|
684
|
-
},
|
|
685
|
-
);
|
|
686
|
-
|
|
687
|
-
it('writes the absent value for every member when the groups are absent', () => {
|
|
688
|
-
const record = mainRecord();
|
|
689
|
-
for (const prefix of [
|
|
690
|
-
'otherTaxableIncome.',
|
|
691
|
-
'attachments.',
|
|
692
|
-
'capitalGainsSummary.',
|
|
693
|
-
'qualifyingCompany.',
|
|
694
|
-
]) {
|
|
695
|
-
expect(Object.keys(record.values).filter(key => key.startsWith(prefix))).toEqual([]);
|
|
696
|
-
}
|
|
697
|
-
const line = mainLine(minimalInput());
|
|
698
|
-
expect(at(line, 887, 50)).toBe(' '.repeat(50));
|
|
699
|
-
expect(at(line, 937, 12)).toBe('0'.repeat(12));
|
|
700
|
-
expect(at(line, 949, 5)).toBe(' '.repeat(5));
|
|
701
|
-
expect(at(line, 954, 10)).toBe('0'.repeat(10));
|
|
702
|
-
expect(at(line, 964, 4)).toBe('0000');
|
|
703
|
-
expect(at(line, 968, 50)).toBe(' '.repeat(50));
|
|
704
|
-
expect(at(line, 1065, 1)).toBe('0');
|
|
705
|
-
expect(at(line, 1066, 24)).toBe('0'.repeat(24));
|
|
706
|
-
expect(at(line, 1090, 1)).toBe('0');
|
|
707
|
-
expect(at(line, 1091, 12)).toBe(' '.repeat(12));
|
|
708
|
-
});
|
|
709
|
-
|
|
710
|
-
it('writes 0 for false capital-gains reasons', () => {
|
|
711
|
-
const input = minimalInput({
|
|
712
|
-
capitalGainsSummary: {
|
|
713
|
-
reasons: {
|
|
714
|
-
lossOrNoGain: false,
|
|
715
|
-
overFiveImprovementBalances: false,
|
|
716
|
-
over14Appendices: false,
|
|
717
|
-
other: false,
|
|
718
|
-
},
|
|
719
|
-
},
|
|
720
|
-
});
|
|
721
|
-
expect(at(mainLine(input), 964, 4)).toBe('0000');
|
|
722
|
-
});
|
|
723
|
-
|
|
724
|
-
describe('833 has capital-gains appendix (SPEC §7.4)', () => {
|
|
725
|
-
it.each([true, false, undefined])(
|
|
726
|
-
'untransmittedCount > 0 makes 833 = yes (hasCapitalGainsAppendix %s)',
|
|
727
|
-
hasCapitalGainsAppendix => {
|
|
728
|
-
const input = minimalInput({
|
|
729
|
-
declarations: { hasCapitalGainsAppendix },
|
|
730
|
-
capitalGainsSummary: { untransmittedCount: 3 },
|
|
731
|
-
});
|
|
732
|
-
const record = mainRecord(input);
|
|
733
|
-
expect(record.values['declarations.hasCapitalGainsAppendix']).toBe(true);
|
|
734
|
-
expect(at(mainLine(input), 833, 1)).toBe('1');
|
|
735
|
-
},
|
|
736
|
-
);
|
|
737
|
-
|
|
738
|
-
it('untransmittedCount 0 leaves 833 = no', () => {
|
|
739
|
-
const input = minimalInput({ capitalGainsSummary: { untransmittedCount: 0 } });
|
|
740
|
-
expect(mainRecord(input).values['declarations.hasCapitalGainsAppendix']).toBe(false);
|
|
741
|
-
expect(at(mainLine(input), 833, 1)).toBe('2');
|
|
742
|
-
});
|
|
743
|
-
});
|
|
744
|
-
|
|
745
|
-
it('raises no notices for the full main input', () => {
|
|
746
|
-
expect(normalizeReport(fullMainInput(), LAYOUT, OPTIONS).notices).toEqual([]);
|
|
747
|
-
});
|
|
748
|
-
});
|
|
749
|
-
|
|
750
|
-
describe('normalizeReport: record 1000 derived codes (SPEC §7.4)', () => {
|
|
751
|
-
const BANK_ACCOUNT = { bank: '12', branch: '345', account: '678' };
|
|
752
|
-
|
|
753
|
-
it('bankAccount → 277 = account, 278 = bank then branch, 280 = 1', () => {
|
|
754
|
-
const input = minimalInput({ bankAccount: BANK_ACCOUNT });
|
|
755
|
-
const record = mainRecord(input);
|
|
756
|
-
expect(record.codes.get('277')).toBe(678);
|
|
757
|
-
expect(record.codes.get('278')).toBe(12_345);
|
|
758
|
-
expect(record.codes.get('280')).toBe(1);
|
|
759
|
-
expect(record.paths['code:277']).toBe('');
|
|
760
|
-
expect(record.paths['code:278']).toBe('');
|
|
761
|
-
expect(record.paths['code:280']).toBe('');
|
|
762
|
-
// 1000@2185: the code-amount section, in ascending code order after 273 = 9.
|
|
763
|
-
expect(mainLine(input).slice(2184)).toContain('2739' + '277000000000678' + '27812345' + '2801');
|
|
764
|
-
expect(normalizeReport(input, LAYOUT, OPTIONS).notices).toEqual([]);
|
|
765
|
-
});
|
|
766
|
-
|
|
767
|
-
it('keeps the leading zeros of the bank in 278 (bank 2 digits, branch 3 digits)', () => {
|
|
768
|
-
const input = minimalInput({
|
|
769
|
-
bankAccount: { bank: '01', branch: '002', account: '000000003' },
|
|
770
|
-
});
|
|
771
|
-
expect(mainRecord(input).codes.get('278')).toBe(1002);
|
|
772
|
-
expect(mainRecord(input).codes.get('277')).toBe(3);
|
|
773
|
-
expect(mainLine(input).slice(2184)).toContain('27801002');
|
|
774
|
-
});
|
|
775
|
-
|
|
776
|
-
it('writes no bank codes without bankAccount', () => {
|
|
777
|
-
const record = mainRecord();
|
|
778
|
-
expect(['277', '278', '280'].filter(code => record.codes.has(code))).toEqual([]);
|
|
779
|
-
});
|
|
780
|
-
|
|
781
|
-
it.each([
|
|
782
|
-
['bank', { bank: '1' }, 'bankAccount.bank'],
|
|
783
|
-
['bank', { bank: '123' }, 'bankAccount.bank'],
|
|
784
|
-
['branch', { branch: '34' }, 'bankAccount.branch'],
|
|
785
|
-
['branch', { branch: '3a5' }, 'bankAccount.branch'],
|
|
786
|
-
['account', { account: '' }, 'bankAccount.account'],
|
|
787
|
-
['account', { account: '1234567890' }, 'bankAccount.account'],
|
|
788
|
-
])(
|
|
789
|
-
'a malformed %s (%o) raises main.bankAccount.format at %s and writes no bank codes',
|
|
790
|
-
(_, overrides, path) => {
|
|
791
|
-
const input = minimalInput({ bankAccount: { ...BANK_ACCOUNT, ...overrides } });
|
|
792
|
-
const report = normalizeReport(input, LAYOUT, OPTIONS);
|
|
793
|
-
expect(report.notices).toEqual([
|
|
794
|
-
expect.objectContaining({
|
|
795
|
-
ruleId: 'main.bankAccount.format',
|
|
796
|
-
severity: 'error',
|
|
797
|
-
path,
|
|
798
|
-
recordType: '1000',
|
|
799
|
-
recordIndex: 0,
|
|
800
|
-
}),
|
|
801
|
-
]);
|
|
802
|
-
const record = report.records[0];
|
|
803
|
-
expect(['277', '278', '280'].filter(code => record?.codes.has(code))).toEqual([]);
|
|
804
|
-
},
|
|
805
|
-
);
|
|
806
|
-
|
|
807
|
-
it.each([
|
|
808
|
-
['obliged', 8],
|
|
809
|
-
['notObliged', 9],
|
|
810
|
-
] as const)('form6111Obligation %s → 297 = %i', (form6111Obligation, expected) => {
|
|
811
|
-
const input = minimalInput({ declarations: { form6111Obligation } });
|
|
812
|
-
const record = mainRecord(input);
|
|
813
|
-
expect(record.codes.get('297')).toBe(expected);
|
|
814
|
-
expect(record.paths['code:297']).toBe('');
|
|
815
|
-
expect(mainLine(input).slice(2184)).toContain(`297${expected}`);
|
|
816
|
-
});
|
|
817
|
-
|
|
818
|
-
it.each(['notRelevant', undefined] as const)(
|
|
819
|
-
'form6111Obligation %s → no 297',
|
|
820
|
-
form6111Obligation => {
|
|
821
|
-
expect(
|
|
822
|
-
mainRecord(minimalInput({ declarations: { form6111Obligation } })).codes.has('297'),
|
|
823
|
-
).toBe(false);
|
|
824
|
-
},
|
|
825
|
-
);
|
|
826
|
-
|
|
827
|
-
it('capitalGainsSummary.untransmittedCount 3 → 028 = 3', () => {
|
|
828
|
-
const input = minimalInput({ capitalGainsSummary: { untransmittedCount: 3 } });
|
|
829
|
-
const record = mainRecord(input);
|
|
830
|
-
expect(record.codes.get('028')).toBe(3);
|
|
831
|
-
expect(record.paths['code:028']).toBe('');
|
|
832
|
-
expect(mainLine(input).slice(2184)).toContain('02803');
|
|
833
|
-
});
|
|
834
|
-
|
|
835
|
-
it.each([0, undefined])('untransmittedCount %s → no 028', untransmittedCount => {
|
|
836
|
-
const input = minimalInput({ capitalGainsSummary: { untransmittedCount } });
|
|
837
|
-
expect(mainRecord(input).codes.has('028')).toBe(false);
|
|
838
|
-
});
|
|
839
|
-
});
|