mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 14:14:04 +00:00
Simplify the slack channel usage test
This commit is contained in:
parent
a13110c880
commit
718afd3069
1 changed files with 11 additions and 22 deletions
|
|
@ -363,35 +363,24 @@ test('slack channel uses correct webhook urls', function () {
|
|||
];
|
||||
|
||||
// Test central context - should attempt to use central webhook
|
||||
// Because the Slack channel uses cURL to send messages, we cannot use Http::fake() here.
|
||||
// Instead, we catch the exception and check the error message which contains the actual webhook URL.
|
||||
try {
|
||||
logger('central');
|
||||
} catch (Exception $e) {
|
||||
expect($e->getMessage())->toContain('central-webhook');
|
||||
}
|
||||
|
||||
// Test tenant 1 context - should attempt to use tenant1 webhook
|
||||
tenancy()->initialize($tenant1);
|
||||
// Slack channel should attempt to use the tenant-specific webhooks
|
||||
tenancy()->runForMultiple([$tenant1, $tenant2], function (Tenant $tenant) {
|
||||
try {
|
||||
logger($tenant->id);
|
||||
} catch (Exception $e) {
|
||||
expect($e->getMessage())->toContain($tenant->slackUrl);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
logger('tenant1');
|
||||
} catch (Exception $e) {
|
||||
expect($e->getMessage())->toContain('tenant1-webhook');
|
||||
}
|
||||
|
||||
tenancy()->end();
|
||||
|
||||
// Test tenant 2 context - should attempt to use tenant2 webhook
|
||||
tenancy()->initialize($tenant2);
|
||||
|
||||
try {
|
||||
logger('tenant2');
|
||||
} catch (Exception $e) {
|
||||
expect($e->getMessage())->toContain('tenant2-webhook');
|
||||
}
|
||||
|
||||
tenancy()->end();
|
||||
|
||||
// Back to central - should use central webhook again
|
||||
// Central context, central webhook should be used again
|
||||
try {
|
||||
logger('central');
|
||||
} catch (Exception $e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue