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

fix tests

This commit is contained in:
Samuel Štancl 2022-09-02 18:51:55 +02:00 committed by GitHub
parent 84df124355
commit def75e5e22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -135,10 +135,15 @@ test('tenant parameter is set for all routes as the default parameter once the t
expect(tenancy()->initialized)->toBeFalse(); expect(tenancy()->initialized)->toBeFalse();
// make a request that will initialize tenancy
pest()->get(route('foo', ['tenant' => 'acme', 'a' => 1, 'b' => 2])); pest()->get(route('foo', ['tenant' => 'acme', 'a' => 1, 'b' => 2]));
expect(tenancy()->initialized)->toBeTrue() expect(tenancy()->initialized)->toBeTrue();
->and(tenant('id'))->toBe('acme') expect(tenant('id'))->toBe('acme');
->and(route('baz', ['a' => 1, 'b' => 2]))->toBe('http://localhost/acme/baz/1/2');
// assert that the route WITHOUT the tenant parameter matches the route WITH the tenant parameter
expect(route('baz', ['a' => 1, 'b' => 2]))->toBe(route('baz', ['tenant' => acme, 'a' => 1, 'b' => 2]));
expect(route('baz', ['a' => 1, 'b' => 2]))->toBe('http://localhost/acme/baz/1/2'); // assert the full route string
pest()->get(route('baz', ['a' => 1, 'b' => 2]))->assertOk(); // Assert route don't need tenant parameter pest()->get(route('baz', ['a' => 1, 'b' => 2]))->assertOk(); // Assert route don't need tenant parameter
}); });