summaryrefslogtreecommitdiff
path: root/packages/integrations/netlify/test/functions/404.test.js
blob: a1f792ce0ca7567f6f2881e98a6eb6b55bd3d805 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { expect } from "chai";
import fs from "fs/promises";
import { cli } from "./test-utils.js";
import { fileURLToPath } from "url";

const root = new URL("./fixtures/404/", import.meta.url).toString();

describe("404 page", () => {
  before(async () => {
    await cli("build", "--root", fileURLToPath(root));
  });

  it("404 route is included in the redirect file", async () => {
    const redir = await fs.readFile(
      new URL("./dist/_redirects", root),
      "utf-8",
    );
    const expr = new RegExp("/*    /.netlify/functions/entry    404");
    expect(redir).to.match(expr);
  });
});