-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into upsert-endpoint
- Loading branch information
Showing
236 changed files
with
3,801 additions
and
2,103 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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
38 changes: 38 additions & 0 deletions
38
packages/twenty-front/src/modules/captcha/utils/__tests__/getCaptchaUrlByProvider.test.ts
This file contains 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,38 @@ | ||
import { expect } from '@storybook/test'; | ||
|
||
import { CaptchaDriverType } from '~/generated/graphql'; | ||
|
||
import { getCaptchaUrlByProvider } from '../getCaptchaUrlByProvider'; | ||
|
||
describe('getCaptchaUrlByProvider', () => { | ||
it('handles GoogleRecaptcha', async () => { | ||
const captchaUrl = getCaptchaUrlByProvider( | ||
CaptchaDriverType.GoogleRecaptcha, | ||
'siteKey', | ||
); | ||
|
||
expect(captchaUrl).toEqual( | ||
'https://www.google.com/recaptcha/api.js?render=siteKey', | ||
); | ||
|
||
expect(() => | ||
getCaptchaUrlByProvider(CaptchaDriverType.GoogleRecaptcha, ''), | ||
).toThrow( | ||
'SiteKey must be provided while generating url for GoogleRecaptcha provider', | ||
); | ||
}); | ||
|
||
it('handles Turnstile', async () => { | ||
const captchaUrl = getCaptchaUrlByProvider(CaptchaDriverType.Turnstile, ''); | ||
|
||
expect(captchaUrl).toEqual( | ||
'https://challenges.cloudflare.com/turnstile/v0/api.js', | ||
); | ||
}); | ||
|
||
it('handles unknown provider', async () => { | ||
expect(() => | ||
getCaptchaUrlByProvider('Unknown' as CaptchaDriverType, ''), | ||
).toThrow('Unknown captcha provider'); | ||
}); | ||
}); |
20 changes: 13 additions & 7 deletions
20
packages/twenty-front/src/modules/captcha/utils/getCaptchaUrlByProvider.ts
This file contains 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,16 +1,22 @@ | ||
import { CaptchaDriverType } from '~/generated-metadata/graphql'; | ||
import { isNonEmptyString } from '@sniptt/guards'; | ||
|
||
export const getCaptchaUrlByProvider = (name: string, siteKey: string) => { | ||
if (!name) { | ||
return ''; | ||
} | ||
import { CaptchaDriverType } from '~/generated-metadata/graphql'; | ||
|
||
export const getCaptchaUrlByProvider = ( | ||
name: CaptchaDriverType, | ||
siteKey: string, | ||
) => { | ||
switch (name) { | ||
case CaptchaDriverType.GoogleRecatpcha: | ||
case CaptchaDriverType.GoogleRecaptcha: | ||
if (!isNonEmptyString(siteKey)) { | ||
throw new Error( | ||
'SiteKey must be provided while generating url for GoogleRecaptcha provider', | ||
); | ||
} | ||
return `https://www.google.com/recaptcha/api.js?render=${siteKey}`; | ||
case CaptchaDriverType.Turnstile: | ||
return 'https://challenges.cloudflare.com/turnstile/v0/api.js'; | ||
default: | ||
return ''; | ||
throw new Error('Unknown captcha provider'); | ||
} | ||
}; |
15 changes: 15 additions & 0 deletions
15
...ages/twenty-front/src/modules/databases/utils/__tests__/getForeignDataWrapperType.test.ts
This file contains 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,15 @@ | ||
import { getForeignDataWrapperType } from '../getForeignDataWrapperType'; | ||
|
||
describe('getForeignDataWrapperType', () => { | ||
it('should handle postgres', () => { | ||
expect(getForeignDataWrapperType('postgresql')).toBe('postgres_fdw'); | ||
}); | ||
|
||
it('should handle stripe', () => { | ||
expect(getForeignDataWrapperType('stripe')).toBe('stripe_fdw'); | ||
}); | ||
|
||
it('should return null for unknown', () => { | ||
expect(getForeignDataWrapperType('unknown')).toBeNull(); | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
packages/twenty-front/src/modules/navigation/utils/__tests__/indexAppPath.test.ts
This file contains 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,10 @@ | ||
import { AppPath } from '@/types/AppPath'; | ||
|
||
import indexAppPath from '../indexAppPath'; | ||
|
||
describe('getIndexAppPath', () => { | ||
it('returns the index app path', () => { | ||
const { getIndexAppPath } = indexAppPath; | ||
expect(getIndexAppPath()).toEqual(AppPath.Index); | ||
}); | ||
}); |
This file contains 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 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 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -15,4 +15,6 @@ export enum CurrencyCode { | |
QAR = 'QAR', | ||
AED = 'AED', | ||
KRW = 'KRW', | ||
BRL = 'BRL', | ||
AUD = 'AUD', | ||
} |
Oops, something went wrong.