diff mrjunejune/test/create_snapshots.c @ 94:092afa595764

[MrJuneJune] Added Integration tests.
author June Park <parkjune1995@gmail.com>
date Fri, 02 Jan 2026 18:13:32 -0800
parents 6626ec933933
children
line wrap: on
line diff
--- a/mrjunejune/test/create_snapshots.c	Fri Jan 02 18:02:22 2026 -0800
+++ b/mrjunejune/test/create_snapshots.c	Fri Jan 02 18:13:32 2026 -0800
@@ -106,11 +106,23 @@
   // Define snapshots to create - paths that should succeed (200 OK)
   SnapshotConfig success_snapshots[] = {
     {"/", 200, snapshot_path, TEST_HOST, TEST_PORT},
-    {"/index.html", 200, snapshot_path, TEST_HOST, TEST_PORT},
+    {"/resume", 200, snapshot_path, TEST_HOST, TEST_PORT},
+    {"/tools", 200, snapshot_path, TEST_HOST, TEST_PORT},
+    {"/tools/markdown_to_html", 200, snapshot_path, TEST_HOST, TEST_PORT},
+    {"/tools/file_converter", 200, snapshot_path, TEST_HOST, TEST_PORT},
   };
   int num_success = sizeof(success_snapshots) / sizeof(success_snapshots[0]);
 
-  // Define snapshots for error paths (404)
+  // Define snapshots for redirect endpoints (301)
+  SnapshotConfig redirect_snapshots[] = {
+    {"/index.html", 301, snapshot_path, TEST_HOST, TEST_PORT},
+    {"/resume/index.html", 301, snapshot_path, TEST_HOST, TEST_PORT},
+    {"/tools/index.html", 301, snapshot_path, TEST_HOST, TEST_PORT},
+    {"/tools/markdown_to_html/index.html", 301, snapshot_path, TEST_HOST, TEST_PORT},
+    {"/tools/file_converter/index.html", 301, snapshot_path, TEST_HOST, TEST_PORT},
+  };
+  int num_redirects = sizeof(redirect_snapshots) / sizeof(redirect_snapshots[0]);
+
   SnapshotConfig error_snapshots[] = {
     {"/nonexistent", 404, snapshot_path, TEST_HOST, TEST_PORT},
     {"/does/not/exist", 404, snapshot_path, TEST_HOST, TEST_PORT},
@@ -135,8 +147,22 @@
     }
   }
 
+  // Create redirect snapshots
+  printf("\nCreating snapshots for redirect paths:\n\n");
+  for (int i = 0; i < num_redirects; i++)
+  {
+    if (Seobeo_Snapshot_Create(&redirect_snapshots[i]) == 0)
+    {
+      total_passed++;
+    }
+    else
+    {
+      total_failed++;
+    }
+  }
+
   // Create error snapshots
-  printf("Creating snapshots for error paths:\n\n");
+  printf("\nCreating snapshots for error paths:\n\n");
   for (int i = 0; i < num_errors; i++)
   {
     if (Seobeo_Snapshot_Create(&error_snapshots[i]) == 0)