view mrjunejune/test/auto_generated_test.c @ 268:f7b1188d5fb1

support repo rules Copilot bundle path Match both +_repo_rules2+ and +http_archive+ Copilot CLI repository layouts during deployment and production startup. Co-authored-by: Copilot <[email protected]>
author MrJuneJune <me@mrjunejune.com>
date Fri, 07 Aug 2026 13:02:41 -0700
parents 1f9877b637e9
children
line wrap: on
line source

// Auto-generated test file
// Source: /Users/mrjunejune/zenbu/mrjunejune/main.c
// DO NOT EDIT - Regenerate with: bazel run //seobeo:test_generator

#include "mrjunejune/test/test.h"

#define TEST_HOST "127.0.0.1"
#define TEST_PORT "6969"

int main(int argc, char *argv[])
{
  printf("=== Auto-generated Snapshot Creator ===\n\n");

  const char *server_binary = "./mrjunejune_server";
  if (argc > 1) server_binary = argv[1];

  pid_t server_pid = start_test_server(server_binary);
  if (server_pid < 0) return 1;

  SnapshotConfig configs[] = {
    {"/", 200, SNAPSHOT_DIR, TEST_HOST, TEST_PORT},
    {"/index.html", 301, SNAPSHOT_DIR, TEST_HOST, TEST_PORT},
    {"/resume", 200, SNAPSHOT_DIR, TEST_HOST, TEST_PORT},
    {"/resume/index.html", 301, SNAPSHOT_DIR, TEST_HOST, TEST_PORT},
    {"/tools", 200, SNAPSHOT_DIR, TEST_HOST, TEST_PORT},
    {"/tools/index.html", 301, SNAPSHOT_DIR, TEST_HOST, TEST_PORT},
    {"/tools/markdown_to_html", 200, SNAPSHOT_DIR, TEST_HOST, TEST_PORT},
    {"/tools/markdown_to_html/index.html", 301, SNAPSHOT_DIR, TEST_HOST, TEST_PORT},
    {"/tools/file_converter", 200, SNAPSHOT_DIR, TEST_HOST, TEST_PORT},
    {"/tools/file_converter/index.html", 301, SNAPSHOT_DIR, TEST_HOST, TEST_PORT},
    {"/tools/hls_player", 200, SNAPSHOT_DIR, TEST_HOST, TEST_PORT},
    {"/tools/hls_player/index.html", 301, SNAPSHOT_DIR, TEST_HOST, TEST_PORT},
    {"/tools/latex_editor", 200, SNAPSHOT_DIR, TEST_HOST, TEST_PORT},
    {"/tools/latex_editor/index.html", 301, SNAPSHOT_DIR, TEST_HOST, TEST_PORT},
    // TODO: POST route - POST /api/convert/image-to-webp - requires request body
    // TODO: POST route - POST /api/convert/video-to-mp4 - requires request body
    // TODO: Dynamic route - GET /api/download/:filename - fill in actual path
    {"/blog", 200, SNAPSHOT_DIR, TEST_HOST, TEST_PORT},
    // TODO: Dynamic route - GET /blog/:blog_id - fill in actual path
    {"/talk", 200, SNAPSHOT_DIR, TEST_HOST, TEST_PORT},
    {"/talk/index.html", 301, SNAPSHOT_DIR, TEST_HOST, TEST_PORT},
    {"/jrpg", 200, SNAPSHOT_DIR, TEST_HOST, TEST_PORT},
    {"/jrpg/index.html", 301, SNAPSHOT_DIR, TEST_HOST, TEST_PORT},
  };

  int count = sizeof(configs) / sizeof(configs[0]);
  int result = 0;
  if (argc > 2)
  {
    int found = 0;
    for (int i = 0; i < count; i++)
    {
      if (strcmp(configs[i].path, argv[2]) != 0)
        continue;
      result = Seobeo_Snapshot_Create(&configs[i]);
      found = 1;
      break;
    }
    if (!found)
    {
      fprintf(stderr, "No snapshot route configured for %s\n", argv[2]);
      result = 1;
    }
  }
  else
  {
    result = Seobeo_Snapshots_Create_Batch(configs, count);
  }

  stop_test_server(server_pid);
  return result;
}