49 lines
1.7 KiB
PHP
49 lines
1.7 KiB
PHP
<?php
|
|
|
|
use App\Domains\Bio\Models\BioPage;
|
|
use App\Domains\Workspace\Models\Workspace;
|
|
|
|
it('returns free path-url for free plan workspace', function () {
|
|
$ws = Workspace::factory()->free()->create(['slug' => 'nexxo']);
|
|
$bio = BioPage::factory()->for($ws)->create(['slug' => 'my-bio']);
|
|
|
|
expect($bio->publicUrl())->toBe('https://nimu.li/b/nexxo/my-bio');
|
|
});
|
|
|
|
it('returns shortPublicUrl without scheme', function () {
|
|
$ws = Workspace::factory()->free()->create(['slug' => 'nexxo']);
|
|
$bio = BioPage::factory()->for($ws)->create(['slug' => 'my-bio']);
|
|
|
|
expect($bio->shortPublicUrl())->toBe('nimu.li/b/nexxo/my-bio');
|
|
});
|
|
|
|
it('returns pro subdomain-url when subdomain_full set', function () {
|
|
$ws = Workspace::factory()->pro()->create([
|
|
'slug' => 'acme',
|
|
'subdomain_full' => 'acme.nimu.li',
|
|
]);
|
|
$bio = BioPage::factory()->for($ws)->create(['slug' => 'john']);
|
|
|
|
expect($bio->publicUrl())->toBe('https://acme.nimu.li/b/john');
|
|
});
|
|
|
|
it('returns custom-domain-url when subdomain_host is non-apex domain', function () {
|
|
$ws = Workspace::factory()->pro()->create(['slug' => 'acme']);
|
|
$bio = BioPage::factory()->for($ws)->create([
|
|
'slug' => 'page',
|
|
'subdomain_host' => 'links.acme.de',
|
|
]);
|
|
|
|
expect($bio->publicUrl())->toBe('https://links.acme.de/b/page');
|
|
});
|
|
|
|
it('falls back to free path when no subdomain_full on paid plan', function () {
|
|
$ws = Workspace::factory()->pro()->create([
|
|
'slug' => 'acme',
|
|
'subdomain_full' => null,
|
|
]);
|
|
$bio = BioPage::factory()->for($ws)->create(['slug' => 'test']);
|
|
|
|
expect($bio->publicUrl())->toBe('https://nimu.li/b/acme/test');
|
|
});
|