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

add comments above new tests

This commit is contained in:
Samuel Štancl 2022-10-12 19:16:03 +02:00 committed by GitHub
parent 05ed7214b0
commit e1fa543723
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -127,6 +127,9 @@ test('only the synced columns are updated in the central db', function () {
], ResourceUser::first()->getAttributes()); ], ResourceUser::first()->getAttributes());
}); });
// This tests attribute list on the central side, and default values on the tenant side
// Those two don't depend on each other, we're just testing having each option on each side
// using tests that combine the two, to avoid having an excessively long and complex test suite
test('sync resource creation works when central model provides attributes and resource model provides default values', function () { test('sync resource creation works when central model provides attributes and resource model provides default values', function () {
// when central model provides attributes => resoucre model will be created from the attribute values // when central model provides attributes => resoucre model will be created from the attribute values
[$tenant1, $tenant2] = creareTenantsAndRunMigrations(); [$tenant1, $tenant2] = creareTenantsAndRunMigrations();
@ -180,6 +183,9 @@ test('sync resource creation works when central model provides attributes and re
expect($centralUser->foo)->toBe('bar'); expect($centralUser->foo)->toBe('bar');
}); });
// This tests default values on the central side, and attribute list on the tenant side
// Those two don't depend on each other, we're just testing having each option on each side
// using tests that combine the two, to avoid having an excessively long and complex test suite
test('sync resource creation works when central model provides default values and resource model provides attributes', function () { test('sync resource creation works when central model provides default values and resource model provides attributes', function () {
// when central model provides default values => resource model will be created using the default values // when central model provides default values => resource model will be created using the default values
[$tenant1, $tenant2] = creareTenantsAndRunMigrations(); [$tenant1, $tenant2] = creareTenantsAndRunMigrations();
@ -231,6 +237,10 @@ test('sync resource creation works when central model provides default values an
expect($centralUser->role)->toBe('commenter'); expect($centralUser->role)->toBe('commenter');
}); });
// This tests mixed attribute list/defaults on the central side, and no specified attributes on the tenant side
// Those two don't depend on each other, we're just testing having each option on each side
// using tests that combine the two, to avoid having an excessively long and complex test suite
test('sync resource creation works when central model provides mixture and resource model provides nothing using different schemas', function () { test('sync resource creation works when central model provides mixture and resource model provides nothing using different schemas', function () {
// when central model provides mix of attribute and default values => resource model will be created using the mix of attribute values and default values // when central model provides mix of attribute and default values => resource model will be created using the mix of attribute values and default values
[$tenant1, $tenant2] = creareTenantsAndRunMigrationsForDifferentSchema(); [$tenant1, $tenant2] = creareTenantsAndRunMigrationsForDifferentSchema();
@ -285,6 +295,9 @@ test('sync resource creation works when central model provides mixture and resou
expect($centralUser)->toBe($resourceUser); expect($centralUser)->toBe($resourceUser);
}); });
// This tests no specified attributes on the central side, and mixed attribute list/defaults on the tenant side
// Those two don't depend on each other, we're just testing having each option on each side
// using tests that combine the two, to avoid having an excessively long and complex test suite
test('sync resource creation works when central model provides nothing and resource model provides mixture using different schemas', function () { test('sync resource creation works when central model provides nothing and resource model provides mixture using different schemas', function () {
// when central model provides nothing => resoucre model will be 1:1 copy // when central model provides nothing => resoucre model will be 1:1 copy
[$tenant1, $tenant2] = creareTenantsAndRunMigrationsForDifferentSchema(); [$tenant1, $tenant2] = creareTenantsAndRunMigrationsForDifferentSchema();