-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add manifest integration tests #18203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d130037
Add tests
martmull 8b693fd
Fix invalid standard UUID
martmull 1808c72
Fix tests
martmull f491bb9
Fix tests
martmull 889ba81
Factorize
martmull 3f4a13e
Fix tests
martmull 924423f
Fix invalid standard UUID 2
martmull 059ba7f
Replace invalid uuids
martmull aa74039
Code review return: Charles
martmull File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
561 changes: 561 additions & 0 deletions
561
...s/upgrade-version-command/1-19/1-19-fix-invalid-standard-universal-identifiers.command.ts
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
143 changes: 143 additions & 0 deletions
143
...t-metadata/utils/__tests__/are-flat-object-metadata-names-synced-with-labels.util.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,143 @@ | ||
| import { areFlatObjectMetadataNamesSyncedWithLabels } from 'src/engine/metadata-modules/flat-object-metadata/utils/are-flat-object-metadata-names-synced-with-labels.util'; | ||
| import { TWENTY_STANDARD_APPLICATION } from 'src/engine/workspace-manager/twenty-standard-application/constants/twenty-standard-applications'; | ||
| import { type WorkspaceMigrationBuilderOptions } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/types/workspace-migration-builder-options.type'; | ||
|
|
||
| const THIRD_PARTY_BUILD_OPTIONS: WorkspaceMigrationBuilderOptions = { | ||
| isSystemBuild: false, | ||
| applicationUniversalIdentifier: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee', | ||
| }; | ||
|
|
||
| const TWENTY_STANDARD_BUILD_OPTIONS: WorkspaceMigrationBuilderOptions = { | ||
| isSystemBuild: false, | ||
| applicationUniversalIdentifier: | ||
| TWENTY_STANDARD_APPLICATION.universalIdentifier, | ||
| }; | ||
|
|
||
| describe('areFlatObjectMetadataNamesSyncedWithLabels', () => { | ||
| it('should return true when names match computed names from labels', () => { | ||
| const result = areFlatObjectMetadataNamesSyncedWithLabels({ | ||
| flatObjectMetadata: { | ||
| nameSingular: 'ticket', | ||
| namePlural: 'tickets', | ||
| labelSingular: 'Ticket', | ||
| labelPlural: 'Tickets', | ||
| }, | ||
| buildOptions: THIRD_PARTY_BUILD_OPTIONS, | ||
| }); | ||
|
|
||
| expect(result).toBe(true); | ||
| }); | ||
|
|
||
| it('should return false when singular name does not match', () => { | ||
| const result = areFlatObjectMetadataNamesSyncedWithLabels({ | ||
| flatObjectMetadata: { | ||
| nameSingular: 'wrongName', | ||
| namePlural: 'tickets', | ||
| labelSingular: 'Ticket', | ||
| labelPlural: 'Tickets', | ||
| }, | ||
| buildOptions: THIRD_PARTY_BUILD_OPTIONS, | ||
| }); | ||
|
|
||
| expect(result).toBe(false); | ||
| }); | ||
|
|
||
| it('should return false when plural name does not match', () => { | ||
| const result = areFlatObjectMetadataNamesSyncedWithLabels({ | ||
| flatObjectMetadata: { | ||
| nameSingular: 'ticket', | ||
| namePlural: 'wrongPlural', | ||
| labelSingular: 'Ticket', | ||
| labelPlural: 'Tickets', | ||
| }, | ||
| buildOptions: THIRD_PARTY_BUILD_OPTIONS, | ||
| }); | ||
|
|
||
| expect(result).toBe(false); | ||
| }); | ||
|
|
||
| it('should apply custom suffix for reserved words when caller is a third-party app', () => { | ||
| // "Event" computes to "event" which is reserved, so suffix "Custom" is appended | ||
| const result = areFlatObjectMetadataNamesSyncedWithLabels({ | ||
| flatObjectMetadata: { | ||
| nameSingular: 'eventCustom', | ||
| namePlural: 'eventsCustom', | ||
| labelSingular: 'Event', | ||
| labelPlural: 'Events', | ||
| }, | ||
| buildOptions: THIRD_PARTY_BUILD_OPTIONS, | ||
| }); | ||
|
|
||
| expect(result).toBe(true); | ||
| }); | ||
|
|
||
| it('should return false for reserved words without custom suffix when caller is a third-party app', () => { | ||
| const result = areFlatObjectMetadataNamesSyncedWithLabels({ | ||
| flatObjectMetadata: { | ||
| nameSingular: 'event', | ||
| namePlural: 'events', | ||
| labelSingular: 'Event', | ||
| labelPlural: 'Events', | ||
| }, | ||
| buildOptions: THIRD_PARTY_BUILD_OPTIONS, | ||
| }); | ||
|
|
||
| expect(result).toBe(false); | ||
| }); | ||
|
|
||
| it('should not apply custom suffix for reserved words when caller is the Twenty Standard app', () => { | ||
| const result = areFlatObjectMetadataNamesSyncedWithLabels({ | ||
| flatObjectMetadata: { | ||
| nameSingular: 'event', | ||
| namePlural: 'events', | ||
| labelSingular: 'Event', | ||
| labelPlural: 'Events', | ||
| }, | ||
| buildOptions: TWENTY_STANDARD_BUILD_OPTIONS, | ||
| }); | ||
|
|
||
| expect(result).toBe(true); | ||
| }); | ||
|
|
||
| it('should handle multi-word labels by computing camelCase names', () => { | ||
| const result = areFlatObjectMetadataNamesSyncedWithLabels({ | ||
| flatObjectMetadata: { | ||
| nameSingular: 'supportTicket', | ||
| namePlural: 'supportTickets', | ||
| labelSingular: 'Support Ticket', | ||
| labelPlural: 'Support Tickets', | ||
| }, | ||
| buildOptions: THIRD_PARTY_BUILD_OPTIONS, | ||
| }); | ||
|
|
||
| expect(result).toBe(true); | ||
| }); | ||
|
|
||
| it('should return false when both names do not match', () => { | ||
| const result = areFlatObjectMetadataNamesSyncedWithLabels({ | ||
| flatObjectMetadata: { | ||
| nameSingular: 'foo', | ||
| namePlural: 'bar', | ||
| labelSingular: 'Ticket', | ||
| labelPlural: 'Tickets', | ||
| }, | ||
| buildOptions: THIRD_PARTY_BUILD_OPTIONS, | ||
| }); | ||
|
|
||
| expect(result).toBe(false); | ||
| }); | ||
|
|
||
| it('should return true with complex labels', () => { | ||
| const result = areFlatObjectMetadataNamesSyncedWithLabels({ | ||
| flatObjectMetadata: { | ||
| nameSingular: 'wrongCreatedAtObject', | ||
| namePlural: 'wrongCreatedAtObjects', | ||
| labelSingular: 'Wrong CreatedAt Object', | ||
| labelPlural: 'Wrong CreatedAt Objects', | ||
| }, | ||
| buildOptions: THIRD_PARTY_BUILD_OPTIONS, | ||
| }); | ||
|
|
||
| expect(result).toBe(true); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...engine/workspace-manager/twenty-standard-application/constants/standard-agent.constant.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../engine/workspace-manager/twenty-standard-application/constants/standard-role.constant.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| export const STANDARD_ROLE = { | ||
| admin: { universalIdentifier: '20202020-0001-0001-0001-000000000001' }, | ||
| admin: { universalIdentifier: '20202020-02c2-43f2-b94d-cab1f2b532eb' }, | ||
| } as const satisfies Record<string, { universalIdentifier: string }>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.