AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

LegalPagesTest.php 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. namespace Tests\Feature;
  3. use App\Http\Controllers\LegalController;
  4. use Inertia\Testing\AssertableInertia as Assert;
  5. use Tests\TestCase;
  6. class LegalPagesTest extends TestCase
  7. {
  8. public function test_visitors_can_read_the_privacy_policy()
  9. {
  10. config([
  11. 'legal.operator' => 'Mirfalah Sdn Bhd',
  12. 'legal.registration' => '202601234567',
  13. 'legal.email' => 'privacy@example.com',
  14. ]);
  15. $this->get(route('privacy'))
  16. ->assertOk()
  17. ->assertInertia(fn (Assert $page) => $page
  18. ->component('legal/privacy')
  19. ->where('operator', 'Mirfalah Sdn Bhd')
  20. ->where('registration', '202601234567')
  21. ->where('email', 'privacy@example.com')
  22. ->where('updated', '22 November 2026')
  23. ->has('aiCompanies'));
  24. }
  25. public function test_visitors_can_read_the_terms()
  26. {
  27. $this->get(route('terms'))
  28. ->assertOk()
  29. ->assertInertia(fn (Assert $page) => $page
  30. ->component('legal/terms')
  31. ->where('trialDays', 14));
  32. }
  33. public function test_the_pages_name_the_ai_companies_the_tasks_use_now()
  34. {
  35. config([
  36. 'ai.tasks.generate.provider' => 'claude',
  37. 'ai.tasks.edit.provider' => 'deepseek',
  38. ]);
  39. $this->assertSame([
  40. ['name' => 'Anthropic', 'country' => 'the United States'],
  41. ['name' => 'DeepSeek', 'country' => 'China'],
  42. ], LegalController::aiCompanies());
  43. // After switching every task to one provider, only that company is named.
  44. config(['ai.tasks.edit.provider' => 'claude']);
  45. $this->assertSame([
  46. ['name' => 'Anthropic', 'country' => 'the United States'],
  47. ], LegalController::aiCompanies());
  48. }
  49. public function test_every_real_ai_provider_has_a_company_for_the_legal_pages()
  50. {
  51. $providers = array_diff(array_keys(config('ai.providers')), ['fake']);
  52. foreach ($providers as $provider) {
  53. $this->assertNotNull(
  54. config("legal.ai_companies.{$provider}"),
  55. "Add the company behind the \"{$provider}\" AI provider to config/legal.php, so the privacy policy names it.",
  56. );
  57. }
  58. }
  59. public function test_the_sign_up_page_works_with_its_links_to_the_terms()
  60. {
  61. $this->get(route('register'))->assertOk();
  62. }
  63. }