fix: scraper tests

This commit is contained in:
lapwat committed 2023-02-25 12:08:28 +01:00
1 parent 73f254f6e5
commit 21d17274ce
1 file changed
+1 -1
+1 -1
View File
@@ -11,7 +11,7 @@ func TestBody(t *testing.T) {
c := NewChapterFromURL("https://12factor.net/", "", []*ScrapeConfig{config}, 0, func(index int, name string) {})
got := c.Body()
want := "<!doctype html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n\n <title>The Twelve-Factor App </title>\n <meta name=\"description\" content=\"A methodology for building modern, scalable, maintainable software-as-a-service apps.\">\n <meta name=\"author\" content=\"Adam Wiggins\">\n\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <link rel=\"shortcut icon\" href=\"images/favicon.ico\">\n\n <link rel=\"stylesheet\" href=\"/css/screen.css\" media=\"screen\">\n <link rel=\"stylesheet\" href=\"/css/mobile.css\" media=\"screen\">\n\n <script type=\"text/javascript\" src=\"//use.typekit.com/rsq7tro.js\"></script>\n <script type=\"text/javascript\">try{Typekit.load();}catch(e){}</script>\n</head>\n<body>\n \n\n <header>\n <h1><a href=\"./\" title=\"The Twelve-Factor App\">The Twelve-Factor App</a></h1>\n </header>\n\n <section class=\"abstract\">\n <article>\n<h1 id=\"introduction\">Introduction</h1>\n\n<p>In the modern era, software is commonly delivered as a service: called <em>web apps</em>, or <em>software-as-a-service</em>. The twelve-factor app is a methodology for building software-as-a-service apps that:</p>\n\n<ul>\n<li>Use <strong>declarative</strong> formats for setup automation, to minimize time and cost for new developers joining the project;</li>\n\n<li>Have a <strong>clean contract</strong> with the underlying operating system, offering <strong>maximum portability</strong> between execution environments;</li>\n\n<li>Are suitable for <strong>deployment</strong> on modern <strong>cloud platforms</strong>, obviating the need for servers and systems administration;</li>\n\n<li><strong>Minimize divergence</strong> between development and production, enabling <strong>continuous deployment</strong> for maximum agility;</li>\n\n<li>And can <strong>scale up</strong> without significant changes to tooling, architecture, or development practices.</li>\n</ul>\n\n<p>The twelve-factor methodology can be applied to apps written in any programming language, and which use any combination of backing services (database, queue, memory cache, etc).</p>\n</article>\n <article>\n<h1 id=\"background\">Background</h1>\n\n<p>The contributors to this document have been directly involved in the development and deployment of hundreds of apps, and indirectly witnessed the development, operation, and scaling of hundreds of thousands of apps via our work on the <a href='http://www.heroku.com/' target='_blank'>Heroku</a> platform.</p>\n\n<p>This document synthesizes all of our experience and observations on a wide variety of software-as-a-service apps in the wild. It is a triangulation on ideal practices for app development, paying particular attention to the dynamics of the organic growth of an app over time, the dynamics of collaboration between developers working on the app’s codebase, and <a href='http://blog.heroku.com/archives/2011/6/28/the_new_heroku_4_erosion_resistance_explicit_contracts/' target='_blank'>avoiding the cost of software erosion</a>.</p>\n\n<p>Our motivation is to raise awareness of some systemic problems we’ve seen in modern application development, to provide a shared vocabulary for discussing those problems, and to offer a set of broad conceptual solutions to those problems with accompanying terminology. The format is inspired by Martin Fowler’s books <em><a href='https://books.google.com/books/about/Patterns_of_enterprise_application_archi.html?id=FyWZt5DdvFkC' target='_blank'>Patterns of Enterprise Application Architecture</a></em> and <em><a href='https://books.google.com/books/about/Refactoring.html?id=1MsETFPD3I0C' target='_blank'>Refactoring</a></em>.</p>\n</article>\n <article>\n<h1 id=\"who_should_read_this_document\">Who should read this document?</h1>\n\n<p>Any developer building applications which run as a service. Ops engineers who deploy or manage such applications.</p>\n</article>\n</section>\n\n<section class=\"concrete\">\n <article>\n<h1 id=\"the_twelve_factors\">The Twelve Factors</h1>\n\n<h2 id=\"i_codebase\"><a href=\"./codebase\">I. Codebase</a></h2>\n\n<h3 id=\"one_codebase_tracked_in_revision_control_many_deploys\">One codebase tracked in revision control, many deploys</h3>\n\n<h2 id=\"ii_dependencies\"><a href=\"./dependencies\">II. Dependencies</a></h2>\n\n<h3 id=\"explicitly_declare_and_isolate_dependencies\">Explicitly declare and isolate dependencies</h3>\n\n<h2 id=\"iii_config\"><a href=\"./config\">III. Config</a></h2>\n\n<h3 id=\"store_config_in_the_environment\">Store config in the environment</h3>\n\n<h2 id=\"iv_backing_services\"><a href=\"./backing-services\">IV. Backing services</a></h2>\n\n<h3 id=\"treat_backing_services_as_attached_resources\">Treat backing services as attached resources</h3>\n\n<h2 id=\"v_build_release_run\"><a href=\"./build-release-run\">V. Build, release, run</a></h2>\n\n<h3 id=\"strictly_separate_build_and_run_stages\">Strictly separate build and run stages</h3>\n\n<h2 iLine truncated
want := "<!doctype html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n\n <title>The Twelve-Factor App </title>\n <meta name=\"description\" content=\"A methodology for building modern, scalable, maintainable software-as-a-service apps.\">\n <meta name=\"author\" content=\"Adam Wiggins\">\n\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <link rel=\"shortcut icon\" href=\"images/favicon.ico\">\n\n <link rel=\"stylesheet\" href=\"/css/screen.css\" media=\"screen\">\n <link rel=\"stylesheet\" href=\"/css/mobile.css\" media=\"screen\">\n\n <script type=\"text/javascript\" src=\"//use.typekit.com/rsq7tro.js\"></script>\n <script type=\"text/javascript\">try{Typekit.load();}catch(e){}</script>\n</head>\n<body>\n \n\n <header>\n <h1><a href=\"./\" title=\"The Twelve-Factor App\">The Twelve-Factor App</a></h1>\n </header>\n\n <section class=\"abstract\">\n <article>\n<h1 id=\"introduction\">Introduction</h1>\n\n<p>In the modern era, software is commonly delivered as a service: called <em>web apps</em>, or <em>software-as-a-service</em>. The twelve-factor app is a methodology for building software-as-a-service apps that:</p>\n\n<ul>\n<li>Use <strong>declarative</strong> formats for setup automation, to minimize time and cost for new developers joining the project;</li>\n\n<li>Have a <strong>clean contract</strong> with the underlying operating system, offering <strong>maximum portability</strong> between execution environments;</li>\n\n<li>Are suitable for <strong>deployment</strong> on modern <strong>cloud platforms</strong>, obviating the need for servers and systems administration;</li>\n\n<li><strong>Minimize divergence</strong> between development and production, enabling <strong>continuous deployment</strong> for maximum agility;</li>\n\n<li>And can <strong>scale up</strong> without significant changes to tooling, architecture, or development practices.</li>\n</ul>\n\n<p>The twelve-factor methodology can be applied to apps written in any programming language, and which use any combination of backing services (database, queue, memory cache, etc).</p>\n</article>\n <article>\n<h1 id=\"background\">Background</h1>\n\n<p>The contributors to this document have been directly involved in the development and deployment of hundreds of apps, and indirectly witnessed the development, operation, and scaling of hundreds of thousands of apps via our work on the <a href='http://www.heroku.com/' target='_blank'>Heroku</a> platform.</p>\n\n<p>This document synthesizes all of our experience and observations on a wide variety of software-as-a-service apps in the wild. It is a triangulation on ideal practices for app development, paying particular attention to the dynamics of the organic growth of an app over time, the dynamics of collaboration between developers working on the app’s codebase, and <a href='http://blog.heroku.com/archives/2011/6/28/the_new_heroku_4_erosion_resistance_explicit_contracts/' target='_blank'>avoiding the cost of software erosion</a>.</p>\n\n<p>Our motivation is to raise awareness of some systemic problems we’ve seen in modern application development, to provide a shared vocabulary for discussing those problems, and to offer a set of broad conceptual solutions to those problems with accompanying terminology. The format is inspired by Martin Fowler’s books <em><a href='https://books.google.com/books/about/Patterns_of_enterprise_application_archi.html?id=FyWZt5DdvFkC' target='_blank'>Patterns of Enterprise Application Architecture</a></em> and <em><a href='https://books.google.com/books/about/Refactoring.html?id=1MsETFPD3I0C' target='_blank'>Refactoring</a></em>.</p>\n</article>\n <article>\n<h1 id=\"who_should_read_this_document\">Who should read this document?</h1>\n\n<p>Any developer building applications which run as a service. Ops engineers who deploy or manage such applications.</p>\n</article>\n</section>\n\n<section class=\"concrete\">\n <article>\n<h1 id=\"the_twelve_factors\">The Twelve Factors</h1>\n\n<h2 id=\"i_codebase\"><a href=\"./codebase\">I. Codebase</a></h2>\n\n<h3 id=\"one_codebase_tracked_in_revision_control_many_deploys\">One codebase tracked in revision control, many deploys</h3>\n\n<h2 id=\"ii_dependencies\"><a href=\"./dependencies\">II. Dependencies</a></h2>\n\n<h3 id=\"explicitly_declare_and_isolate_dependencies\">Explicitly declare and isolate dependencies</h3>\n\n<h2 id=\"iii_config\"><a href=\"./config\">III. Config</a></h2>\n\n<h3 id=\"store_config_in_the_environment\">Store config in the environment</h3>\n\n<h2 id=\"iv_backing_services\"><a href=\"./backing-services\">IV. Backing services</a></h2>\n\n<h3 id=\"treat_backing_services_as_attached_resources\">Treat backing services as attached resources</h3>\n\n<h2 id=\"v_build_release_run\"><a href=\"./build-release-run\">V. Build, release, run</a></h2>\n\n<h3 id=\"strictly_separate_build_and_run_stages\">Strictly separate build and run stages</h3>\n\n<h2 iLine truncated
if got != want {
t.Errorf("got %v, wanted %v", got, want)