-
Notifications
You must be signed in to change notification settings - Fork 102
feat(backend): try to match 'wallet address not found' webhook to tenant by prefix #3426
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
njlie
merged 3 commits into
2893/multi-tenancy-v1
from
nl/3414/wa-prefix-not-found-webhook
May 27, 2025
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,14 +9,16 @@ import { Tenant } from '../model' | |
| import { TenantService } from '../service' | ||
| import { faker } from '@faker-js/faker' | ||
| import { exchangeRatesSetting, randomSetting } from '../../tests/tenantSettings' | ||
| import { TenantSetting } from './model' | ||
| import { TenantSetting, TenantSettingKeys } from './model' | ||
| import { | ||
| CreateOptions, | ||
| GetOptions, | ||
| TenantSettingService, | ||
| UpdateOptions | ||
| } from './service' | ||
| import { AuthServiceClient } from '../../auth-service-client/client' | ||
| import { v4 as uuid } from 'uuid' | ||
| import { createTenant } from '../../tests/tenant' | ||
|
|
||
| describe('TenantSetting Service', (): void => { | ||
| let deps: IocContract<AppServices> | ||
|
|
@@ -371,4 +373,37 @@ describe('TenantSetting Service', (): void => { | |
| expect(result).toEqual([]) | ||
| }) | ||
| }) | ||
|
|
||
| describe('get settings by value', (): void => { | ||
| test('can get settings by wallet address prefix setting', async (): Promise<void> => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should add a negative test to check that we avoid fetching a tenant if the prefix doesn't match |
||
| const secondTenant = await createTenant(deps) | ||
| const baseUrl = `https://${faker.internet.domainName()}/${uuid()}` | ||
| const settings = ( | ||
| await Promise.all([ | ||
| tenantSettingService.create({ | ||
| tenantId: tenant.id, | ||
| setting: [ | ||
| { | ||
| key: TenantSettingKeys.WALLET_ADDRESS_URL.name, | ||
| value: `${baseUrl}/${uuid()}` | ||
| } | ||
| ] | ||
| }), | ||
| tenantSettingService.create({ | ||
| tenantId: secondTenant.id, | ||
| setting: [ | ||
| { | ||
| key: TenantSettingKeys.WALLET_ADDRESS_URL.name, | ||
| value: `${baseUrl}/${uuid()}` | ||
| } | ||
| ] | ||
| }) | ||
| ]) | ||
| ).flat() | ||
|
|
||
| const retrievedSettings = | ||
| await tenantSettingService.getSettingsByPrefix(baseUrl) | ||
| expect(retrievedSettings).toEqual(settings) | ||
| }) | ||
| }) | ||
| }) | ||
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh boy. We've been doing something wrong with
withConfigOverride.This never fails. Throw an error, do
expect(true).toBe(false), etc. and you will see it pass.We need to invoke
withConfigOverride(and alsoawaitit). Likeawait withConfigOverride(...)().Outside the scope of this task but we should fix the other usages of
withConfigOverride. Alternatively, instead of evoking it, we could changewithConfigOverrideto work like we've been expecting it to. Just calling the test directly instead of returning a function.I did not test this and would not be surprised if this causes some tests to fail (which were previously incorrectly passing). Also note that our current implementation passes in some
arg: any[]to the test fn but I dont think its actually used anywhere nor do I think we'd even need to use it.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh shoot, that's not 100% right. Was comparing to another example that was working fine.
we just need to change it to this:
from this
The second argument to the jest
testshould just bewithConfigOverride. not an async function withwithConfigOverridein it. So I think it's just this one an not necessarily a widespread problem with our use ofwithConfigOverride.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this! Glad it's just contained to this PR.