1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 13:54:04 +00:00

Revert changes in test

This commit is contained in:
lukinovec 2025-06-26 11:53:42 +02:00
parent 8254b9b7b7
commit 0c41b3ba85

View file

@ -113,12 +113,12 @@ afterEach(function () {
UpdateOrCreateSyncedResource::$scopeGetModelQuery = null;
});
test('creating multiple tenant resources with the same global_id only creates corresponding central resource if it does not exist yet', function () {
test('resources created with the same global id in different tenant dbs will be synced to a single central resource', function () {
$tenants = [Tenant::create(), Tenant::create(), Tenant::create()];
migrateUsersTableForTenants();
// While creating a tenant resource with global_id 'acme',
// a corresponding central resource is attempted to be created ONLY ONCE.
// Only a single central user is created since the same global_id is used for each tenant user
// Therefore all of these tenant users are synced to a single global user
tenancy()->runForMultiple($tenants, function () {
// Create a user with the same global_id in each tenant DB
TenantUser::create([
@ -130,8 +130,6 @@ test('creating multiple tenant resources with the same global_id only creates co
]);
});
// Only a single central user is created.
// No duplicate global_id exception is thrown.
expect(CentralUser::all())->toHaveCount(1);
expect(CentralUser::first()->global_id)->toBe('acme');
});