set('monitoring.browser.dsn', null);
expect(trim(Blade::render('')))->toBe('');
});
test('the configuration carries dsn, release, sdk and the user id only', function () {
config()->set('monitoring.browser.dsn', 'https://public@glitchtip.test/2');
config()->set('sentry.release', 'v1.3.0');
$user = User::forceCreate(['email' => 'kunde@example.com', 'password' => bcrypt('secret'), 'lang' => 'de']);
$this->actingAs($user);
$html = Blade::render('');
preg_match('/toMatchArray([
'dsn' => 'https://public@glitchtip.test/2',
'release' => 'v1.3.0',
'userId' => $user->id,
'area' => 'portal',
])
->and($config['sdk'])->toEndWith('/js/error-reporting/sentry-browser-'.config('monitoring.browser.sdk_version').'.min.js')
->and($html)->toContain('js/error-reporting/error-reporting.js')
->and($html)->not->toContain('kunde@example.com');
});
test('the self-hosted sdk and the loader exist and the loader avoids regex lookbehind', function () {
$loader = file_get_contents(public_path('js/error-reporting/error-reporting.js'));
expect(public_path('js/error-reporting/sentry-browser-'.config('monitoring.browser.sdk_version').'.min.js'))->toBeFile()
->and($loader)->not->toContain('(?<=')
->and($loader)->not->toContain('(?toContain('with([
'layouts/application',
'layouts/auth',
'portal/layouts/application',
'portal/layouts/auth',
'portal/layouts/public',
'web/layouts/application',
'web/user/layouts/application',
]);