n8n/packages
Iván Ovejero 3206b44974
test(core): Improve tests for subworkflow caller policy checks (no-changelog) (#7954)
## Summary
Deduplicate, separate, organize and speed up tests for subworkflow
caller policy checks.

Follow-up to: https://github.com/n8n-io/n8n/pull/7913

```
 PASS  test/unit/PermissionChecker.test.ts
  check()
    ✓ should allow if workflow has no creds (3 ms)
    ✓ should allow if requesting user is instance owner (83 ms)
    ✓ should allow if workflow creds are valid subset (151 ms)
    ✓ should deny if workflow creds are not valid subset (85 ms)
  checkSubworkflowExecutePolicy()
    no caller policy
      ✓ should fall back to N8N_WORKFLOW_CALLER_POLICY_DEFAULT_OPTION (1 ms)
    overridden caller policy
      ✓ if no sharing, policy becomes workflows-from-same-owner (1 ms)
    workflows-from-list caller policy
      ✓ should allow if caller list contains parent workflow ID
      ✓ should deny if caller list does not contain parent workflow ID (1 ms)
    any caller policy
      ✓ should not throw
    workflows-from-same-owner caller policy
      ✓ should deny if the two workflows are owned by different users (1 ms)
      ✓ should allow if both workflows are owned by the same user
```
...

#### How to test the change:
1. ...


## Issues fixed
Include links to Github issue or Community forum post or **Linear
ticket**:
> Important in order to close automatically and provide context to
reviewers

...


## Review / Merge checklist
- [ ] PR title and summary are descriptive. **Remember, the title
automatically goes into the changelog. Use `(no-changelog)` otherwise.**
([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md))
- [ ] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up
ticket created.
- [ ] Tests included.
> A bug is not considered fixed, unless a test is added to prevent it
from happening again. A feature is not complete without tests.
  >
> *(internal)* You can use Slack commands to trigger [e2e
tests](https://www.notion.so/n8n/How-to-use-Test-Instances-d65f49dfc51f441ea44367fb6f67eb0a?pvs=4#a39f9e5ba64a48b58a71d81c837e8227)
or [deploy test
instance](https://www.notion.so/n8n/How-to-use-Test-Instances-d65f49dfc51f441ea44367fb6f67eb0a?pvs=4#f6a177d32bde4b57ae2da0b8e454bfce)
or [deploy early access version on
Cloud](https://www.notion.so/n8n/Cloudbot-3dbe779836004972b7057bc989526998?pvs=4#fef2d36ab02247e1a0f65a74f6fb534e).
2023-12-08 11:21:43 +01:00
..
@n8n fix: Run dev command only for core packages (no-changelog) (#7928) 2023-12-06 17:28:33 +02:00
@n8n_io/eslint-config build: Upgrade lint related packages (#7790) 2023-11-27 09:11:52 +01:00
cli test(core): Improve tests for subworkflow caller policy checks (no-changelog) (#7954) 2023-12-08 11:21:43 +01:00
core refactor: Unify severity and level for all application errors for Sentry (no-changelog) (#7956) 2023-12-07 16:57:02 +01:00
design-system fix: Run dev command only for core packages (no-changelog) (#7928) 2023-12-06 17:28:33 +02:00
editor-ui fix: Disable continue button unless at least 1 cred has been filled (no-changelog) (#7959) 2023-12-07 19:35:34 +02:00
node-dev 🚀 Release 1.19.0 (#7863) 2023-11-29 13:17:03 +01:00
nodes-base refactor: Unify severity and level for all application errors for Sentry (no-changelog) (#7956) 2023-12-07 16:57:02 +01:00
workflow refactor: Unify severity and level for all application errors for Sentry (no-changelog) (#7956) 2023-12-07 16:57:02 +01:00