comparison 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
comparison
equal deleted inserted replaced
93:be91a73d801a 94:092afa595764
104 } 104 }
105 105
106 // Define snapshots to create - paths that should succeed (200 OK) 106 // Define snapshots to create - paths that should succeed (200 OK)
107 SnapshotConfig success_snapshots[] = { 107 SnapshotConfig success_snapshots[] = {
108 {"/", 200, snapshot_path, TEST_HOST, TEST_PORT}, 108 {"/", 200, snapshot_path, TEST_HOST, TEST_PORT},
109 {"/index.html", 200, snapshot_path, TEST_HOST, TEST_PORT}, 109 {"/resume", 200, snapshot_path, TEST_HOST, TEST_PORT},
110 {"/tools", 200, snapshot_path, TEST_HOST, TEST_PORT},
111 {"/tools/markdown_to_html", 200, snapshot_path, TEST_HOST, TEST_PORT},
112 {"/tools/file_converter", 200, snapshot_path, TEST_HOST, TEST_PORT},
110 }; 113 };
111 int num_success = sizeof(success_snapshots) / sizeof(success_snapshots[0]); 114 int num_success = sizeof(success_snapshots) / sizeof(success_snapshots[0]);
112 115
113 // Define snapshots for error paths (404) 116 // Define snapshots for redirect endpoints (301)
117 SnapshotConfig redirect_snapshots[] = {
118 {"/index.html", 301, snapshot_path, TEST_HOST, TEST_PORT},
119 {"/resume/index.html", 301, snapshot_path, TEST_HOST, TEST_PORT},
120 {"/tools/index.html", 301, snapshot_path, TEST_HOST, TEST_PORT},
121 {"/tools/markdown_to_html/index.html", 301, snapshot_path, TEST_HOST, TEST_PORT},
122 {"/tools/file_converter/index.html", 301, snapshot_path, TEST_HOST, TEST_PORT},
123 };
124 int num_redirects = sizeof(redirect_snapshots) / sizeof(redirect_snapshots[0]);
125
114 SnapshotConfig error_snapshots[] = { 126 SnapshotConfig error_snapshots[] = {
115 {"/nonexistent", 404, snapshot_path, TEST_HOST, TEST_PORT}, 127 {"/nonexistent", 404, snapshot_path, TEST_HOST, TEST_PORT},
116 {"/does/not/exist", 404, snapshot_path, TEST_HOST, TEST_PORT}, 128 {"/does/not/exist", 404, snapshot_path, TEST_HOST, TEST_PORT},
117 {"/missing.html", 404, snapshot_path, TEST_HOST, TEST_PORT}, 129 {"/missing.html", 404, snapshot_path, TEST_HOST, TEST_PORT},
118 }; 130 };
133 { 145 {
134 total_failed++; 146 total_failed++;
135 } 147 }
136 } 148 }
137 149
150 // Create redirect snapshots
151 printf("\nCreating snapshots for redirect paths:\n\n");
152 for (int i = 0; i < num_redirects; i++)
153 {
154 if (Seobeo_Snapshot_Create(&redirect_snapshots[i]) == 0)
155 {
156 total_passed++;
157 }
158 else
159 {
160 total_failed++;
161 }
162 }
163
138 // Create error snapshots 164 // Create error snapshots
139 printf("Creating snapshots for error paths:\n\n"); 165 printf("\nCreating snapshots for error paths:\n\n");
140 for (int i = 0; i < num_errors; i++) 166 for (int i = 0; i < num_errors; i++)
141 { 167 {
142 if (Seobeo_Snapshot_Create(&error_snapshots[i]) == 0) 168 if (Seobeo_Snapshot_Create(&error_snapshots[i]) == 0)
143 { 169 {
144 total_passed++; 170 total_passed++;