Skip to content

test(functions): assert FindInMap rejects non-DefaultValue 4th item without transform - #4639

Merged
kddejong merged 1 commit into
aws-cloudformation:mainfrom
kddejong:test/findinmap-defaultvalue-guardrail
Aug 14, 2026
Merged

kddejong merged 1 commit into
aws-cloudformation:mainfrom
kddejong:test/findinmap-defaultvalue-guardrail

Conversation

@kddejong

Copy link
Copy Markdown
Contributor

Description

Follow-up to #4628, which made Fn::FindInMap maxItems unconditionally 4 so a DefaultValue 4th element is accepted without the AWS::LanguageExtensions transform.

This adds a regression/guardrail test asserting that a 4th element which is not a {DefaultValue: ...} object is still rejected via prefixItems[3] ('notanobject' is not of type 'object') even without the transform — locking in that relaxing the arity did not weaken the 4th-element shape check.

Test-only change; no runtime behavior change.

Validation

  • pytest test/unit/rules/functions/test_find_in_map.py -q
  • ruff check / ruff format --check on the changed file

…ithout transform

Now that maxItems is unconditionally 4, add a guardrail test proving the
prefixItems[3] object check still rejects a 4th element that isn't a
{DefaultValue: ...} object even without the AWS::LanguageExtensions
transform.
@codecov

codecov Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.58%. Comparing base (0ce7cfd) to head (626140d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4639   +/-   ##
=======================================
  Coverage   94.58%   94.58%           
=======================================
  Files         432      432           
  Lines       15417    15417           
  Branches     2986     2986           
=======================================
  Hits        14582    14582           
  Misses        456      456           
  Partials      379      379           
Flag Coverage Δ
unittests 94.58% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kddejong
kddejong merged commit d8d5bfb into aws-cloudformation:main Aug 14, 2026
21 checks passed
@kddejong
kddejong deleted the test/findinmap-defaultvalue-guardrail branch August 14, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant