import test from "ava"
import globby from "globby"

const files = globby.sync("**/*", {
  cwd: "../test-boilerplate/dist",
  nodir: true,
})

test("should have a CSS file", (t) => {
  t.is(
    files.filter(
      (file) => file.startsWith("phenomic.browser.") && file.endsWith(".css")
    ).length,
    1
  )
})

@@ -20,36 +20,146 @@
 va%22%0A
-import globby from %22globby%22%0A
+%0Aimport %7B readFileSync %7D from %22fs%22%0Aimport %7B join %7D from %22path%22%0A%0Aimport globby from %22globby%22%0A%0Aconst testFolder = %22../test-boilerplate/dist%22
 %0Acon
@@ -202,34 +202,18 @@
 wd: 
-%22../test-boilerplate/dist%22
+testFolder
 ,%0A  
@@ -396,12 +396,1707 @@
    1%0A  )%0A%7D)%0A
+%0Atest(%22should have html files%22, (t) =%3E %7B%0A  const htmlFiles = files.filter(%0A    (file) =%3E file.endsWith(%22.html%22)%0A  ).sort()%0A%0A  const includes = (file, strings) =%3E %7B%0A    const content = readFileSync(%0A      join(testFolder, file),%0A      %7B encoding: %22utf8%22 %7D%0A    )%0A    return strings.reduce((acc, s) =%3E %7B%0A      const isTheStringInTheContent = content.includes(s)%0A      if (!isTheStringInTheContent) %7B%0A        console.log(s + %22 is not in %22 + file)%0A      %7D%0A      return acc && isTheStringInTheContent%0A    %7D, true)%0A  %7D%0A%0A  t.deepEqual(%0A    htmlFiles,%0A    %5B%0A      %22404.html%22,%0A      %22index.html%22,%0A      %22loading/index.html%22,%0A      %22posts/first-post/index.html%22,%0A      %22posts/hello-world/index.html%22,%0A    %5D%0A  )%0A%0A  // same tests for all pages%0A  t.truthy(includes(%0A    %22404.html%22,%0A    %5B%0A      %22window.__COLLECTION__ = %22 +%0A        %22%5B%7B%5C%22layout%5C%22:%5C%22PageError%5C%22,%5C%22route%5C%22:%5C%22404.html%5C%22,%5C%22description%5C%22%22,%0A    %5D%0A  ))%0A%0A  // ensure all pages have the correct title%0A%0A  t.truthy(includes(%0A    %22404.html%22,%0A    %5B%0A      %22%3E%F0%9F%98%B1 Oooops%22,%0A      %22window.__INITIAL_STATE__ = %7B%5C%22pages%5C%22:%7B%5C%22/404.html%5C%22%22,%0A    %5D%0A  ))%0A%0A  t.truthy(includes(%0A    %22index.html%22,%0A    %5B%0A      %22%3EPhenomic default boilerplate%22,%0A      %22window.__INITIAL_STATE__ = %7B%5C%22pages%5C%22:%7B%5C%22/%5C%22%22,%0A    %5D%0A  ))%0A%0A  t.truthy(includes(%0A    %22loading/index.html%22,%0A    %5B%0A      %22window.__INITIAL_STATE__ = %7B%5C%22pages%5C%22:%7B%5C%22/loading/%5C%22%22,%0A    %5D%0A  ))%0A%0A  t.truthy(includes(%0A    %22posts/first-post/index.html%22,%0A    %5B%0A      %22%3EFirst Post%22,%0A      %22window.__INITIAL_STATE__ = %7B%5C%22pages%5C%22:%7B%5C%22/posts/first-post/%5C%22%22,%0A    %5D%0A  ))%0A%0A  t.truthy(includes(%0A    %22posts/hello-world/index.html%22,%0A    %5B%0A      %22%3EHello World!%22,%0A      %22window.__INITIAL_STATE__ = %7B%5C%22pages%5C%22:%7B%5C%22/posts/hello-world/%5C%22%22,%0A    %5D%0A  ))%0A%7D)%0A

add more integration tests (tests number of html files and page titles)