+const { app } = require(".");
+
+const it = (assertion, callback) => {
+ try {
+ callback();
+ } catch (error) {
+ console.log(`\n${assertion}\n-> ${error}\n`);
+ }
+};
+
+const assertEqual = (actual, expected) => {
+ if (actual !== expected) throw `expected ${expected} but got ${actual}`;
+};
+
+it("returns 404", () => {
+ const { status } = app({ url: "/nothing-here" });
+
+ assertEqual(status, 404);
+});
+
+it("redirects to benlarson.xyz", () => {
+ const {
+ status,
+ headers: { location },
+ } = app({ url: "/" });
+
+ assertEqual(status, 301);
+ assertEqual(location, "https://www.benlarson.xyz/");
+});