Skip to content

test(json-mapper): adding domain level example with formula (#16509)#16510

Open
aHenryJard wants to merge 3 commits into
masterfrom
issue/16509
Open

test(json-mapper): adding domain level example with formula (#16509)#16510
aHenryJard wants to merge 3 commits into
masterfrom
issue/16509

Conversation

@aHenryJard

Copy link
Copy Markdown
Member

Proposed changes

  • add a domain level test coverage on JsonMapper formula usage

Related issues

How to test this PR

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality
  • I wrote test cases for the relevant use cases (coverage and e2e)
  • I added/updated the relevant documentation (either on GitHub or on Notion)
  • Where necessary, I refactored code to improve the overall quality

Further comments

@github-actions github-actions Bot added the filigran team Item from the Filigran team. label Jun 10, 2026
@Filigran-Automation Filigran-Automation changed the title test(jsonMapper): adding domain level example with formula (#16509) test(json-mapper): adding domain level example with formula (#16509) Jun 10, 2026
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 23.44%. Comparing base (ebd4e36) to head (4486265).
⚠️ Report is 22 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #16510      +/-   ##
==========================================
+ Coverage   22.97%   23.44%   +0.47%     
==========================================
  Files        3233     3323      +90     
  Lines      171674   176995    +5321     
  Branches    42549    44701    +2152     
==========================================
+ Hits        39447    41503    +2056     
- Misses     132227   135492    +3265     
Flag Coverage Δ
opencti-client-python 46.30% <ø> (ø)
opencti-front 5.49% <ø> (+0.83%) ⬆️
opencti-graphql 66.44% <ø> (+0.54%) ⬆️

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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aHenryJard aHenryJard marked this pull request as ready for review June 10, 2026 15:16
Copilot AI review requested due to automatic review settings June 10, 2026 15:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds domain-level integration test coverage for JSON Mapper “complex path” formulas in the opencti-graphql ingestion module test suite, aiming to validate formula usage (string concatenation, decision matrix logic, and regexp extraction) when parsing JSON bundles.

Changes:

  • Added integration tests that create a JSON mapper configuration using complex_path.formula.
  • Added a jsonMapperTest scenario parsing a STIX bundle with formula-based attribute mapping.
  • Added a jsonMapperTest scenario covering extractWithRegexp(...) formula behavior.

const result = await jsonMapperTest(testContext, ADMIN_USER, configuration, fileUpload);

expect(result).toBeDefined();
expect(result.nbEntities).toBeGreaterThan(0);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you already check that nbEntities is equal to 4, I think you could remove this line

],
});

const representations = [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could declare it once in a global describe and then use it for the tests as it is exactly the same (except the first is stringified). Or return it from a function to be sure it is a new object in between tests

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I hesitate to move that to a "data' file like we did in some other tests, but in the other hand it can be hidden easily in IDE, will look. Thanks for feedbacks !

aHenryJard and others added 2 commits June 11, 2026 16:03
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

filigran team Item from the Filigran team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(jsonMapper): add domain level test coverage on JsonMapper

3 participants