@@ -48,6 +48,18 @@ test('policy author cannot approve own proposal', function () {
|
||||
$this->post('/regras-investimento/'.$policy->id.'/decidir', ['decision' => 'approved', 'reason' => 'Teste'])->assertForbidden();
|
||||
});
|
||||
|
||||
test('investment preparation consultation keeps policy and reviews private without publishing or changing them', function () {
|
||||
$policy = proposeInvestmentTest($this);
|
||||
$before = InvestmentPolicy::query()->get()->toArray();
|
||||
$reviews = InvestmentPolicyReview::query()->get()->toArray();
|
||||
$response = $this->get('/regras-investimento')->assertOk()->assertViewHas('page', fn (array $page) => $page['encryptHistory'] === true && $page['props']['canManage'] === true);
|
||||
expect($response->headers->get('Cache-Control'))->toContain('private')->toContain('no-store');
|
||||
$this->actingAs($this->f['issuer'])->get('/regras-investimento')->assertOk()->assertViewHas('page', fn (array $page) => $page['props']['canManage'] === false);
|
||||
expect(InvestmentPolicy::query()->get()->toArray())->toBe($before)
|
||||
->and(InvestmentPolicyReview::query()->get()->toArray())->toBe($reviews)
|
||||
->and($policy->fresh()->status)->toBe('pending');
|
||||
});
|
||||
|
||||
test('policy parameters and decisions cannot be rewritten', function () {
|
||||
$policy = proposeInvestmentTest($this);
|
||||
expect(fn () => $policy->update(['ceiling_minor' => 1]))->toThrow(LogicException::class);
|
||||
|
||||
Reference in New Issue
Block a user