Skip to content

Commit

Permalink
Merge branch 'main' into set-up-google-analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
pmcelhaney committed Oct 11, 2022
2 parents da20691 + 54f7cce commit 8cd7d49
Show file tree
Hide file tree
Showing 24 changed files with 30 additions and 33 deletions.
5 changes: 0 additions & 5 deletions .changeset/chilly-students-visit.md

This file was deleted.

2 changes: 1 addition & 1 deletion bin/counterfact.js
Expand Up @@ -6,7 +6,7 @@ import { program } from "commander";
import open from "open";

import { generate } from "../src/typescript-generator/generate.js";
import { start } from "../src/start.js";
import { start } from "../src/server/start.js";

const DEFAULT_PORT = 3100;

Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions src/counterfact.js → src/server/counterfact.js
Expand Up @@ -6,7 +6,8 @@ import os from "node:os";
import $RefParser from "json-schema-ref-parser";
import yaml from "js-yaml";

import { readFile } from "./read-file.js";
import { readFile } from "../util/read-file.js";

import { Registry } from "./registry.js";
import { Dispatcher } from "./dispatcher.js";
import { koaMiddleware } from "./koa-middleware.js";
Expand Down Expand Up @@ -39,7 +40,7 @@ export async function counterfact(
)}/`;

fs.copyFile(
nodePath.join(__dirname, "../templates/response-builder-factory.ts"),
nodePath.join(__dirname, "../../templates/response-builder-factory.ts"),
nodePath.join(basePath, "response-builder-factory.ts")
);

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion src/start.js → src/server/start.js
Expand Up @@ -5,8 +5,9 @@ import bodyParser from "koa-bodyparser";
import { koaSwagger } from "koa2-swagger-ui";
import yaml from "js-yaml";

import { readFile } from "../util/read-file.js";

import { counterfact } from "./counterfact.js";
import { readFile } from "./read-file.js";

const DEFAULT_PORT = 3100;

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/typescript-generator/specification.js
Expand Up @@ -2,7 +2,7 @@ import nodePath from "node:path";

import yaml from "js-yaml";

import { readFile } from "../read-file.js";
import { readFile } from "../util/read-file.js";

import { Requirement } from "./requirement.js";

Expand Down
File renamed without changes.
@@ -1,4 +1,7 @@
import { ContextRegistry, parentPath } from "../src/context-registry.js";
import {
ContextRegistry,
parentPath,
} from "../../src/server/context-registry.js";

describe("moduleRegistry", () => {
it("finds a context that exactly matches the path", () => {
Expand Down
5 changes: 2 additions & 3 deletions test/counterfact.test.js → test/server/counterfact.test.js
@@ -1,9 +1,8 @@
import supertest from "supertest";
import Koa from "koa";

import { counterfact } from "../src/counterfact.js";

import { withTemporaryFiles } from "./lib/with-temporary-files.js";
import { counterfact } from "../../src/server/counterfact.js";
import { withTemporaryFiles } from "../lib/with-temporary-files.js";

describe("integration test", () => {
it("finds a path", async () => {
Expand Down
6 changes: 3 additions & 3 deletions test/dispatcher.test.js → test/server/dispatcher.test.js
@@ -1,6 +1,6 @@
import { Dispatcher } from "../src/dispatcher.js";
import { ContextRegistry } from "../src/context-registry.js";
import { Registry } from "../src/registry.js";
import { Dispatcher } from "../../src/server/dispatcher.js";
import { ContextRegistry } from "../../src/server/context-registry.js";
import { Registry } from "../../src/server/registry.js";

describe("a dispatcher", () => {
it("dispatches a get request to a server and returns the response", async () => {
Expand Down
@@ -1,7 +1,7 @@
import { Registry } from "../src/registry.js";
import { Dispatcher } from "../src/dispatcher.js";
import { koaMiddleware } from "../src/koa-middleware.js";
import { ContextRegistry } from "../src/context-registry.js";
import { Registry } from "../../src/server/registry.js";
import { Dispatcher } from "../../src/server/dispatcher.js";
import { koaMiddleware } from "../../src/server/koa-middleware.js";
import { ContextRegistry } from "../../src/server/context-registry.js";

describe("koa middleware", () => {
it("passes the request to the dispatcher and returns the response", async () => {
Expand Down
@@ -1,10 +1,9 @@
import { once } from "node:events";

import { ModuleLoader } from "../src/module-loader.js";
import { Registry } from "../src/registry.js";
import { ContextRegistry } from "../src/context-registry.js";

import { withTemporaryFiles } from "./lib/with-temporary-files.js";
import { ModuleLoader } from "../../src/server/module-loader.js";
import { Registry } from "../../src/server/registry.js";
import { ContextRegistry } from "../../src/server/context-registry.js";
import { withTemporaryFiles } from "../lib/with-temporary-files.js";

describe("a module loader", () => {
it("finds a file and adds it to the registry", async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/registry.test.js → test/server/registry.test.js
@@ -1,4 +1,4 @@
import { Registry } from "../src/registry.js";
import { Registry } from "../../src/server/registry.js";

describe("a scripted server", () => {
it("knows if a handler exists for a request method at a path", () => {
Expand Down
@@ -1,4 +1,4 @@
import { createResponseBuilder } from "../src/response-builder.js";
import { createResponseBuilder } from "../../src/server/response-builder.js";

describe("a response builder", () => {
it("starts building a response object when the status is selected", () => {
Expand Down
2 changes: 1 addition & 1 deletion test/start.test.js → test/server/start.test.js
@@ -1,4 +1,4 @@
import { landingPageBody } from "../src/start.js";
import { landingPageBody } from "../../src/server/start.js";

describe("start", () => {
it("renders the landing page", () => {
Expand Down
2 changes: 1 addition & 1 deletion test/tools.test.js → test/server/tools.test.js
@@ -1,4 +1,4 @@
import { Tools } from "../src/tools.js";
import { Tools } from "../../src/server/tools.js";

describe("tools", () => {
it("oneOf()", () => {
Expand Down
5 changes: 2 additions & 3 deletions test/transpiler.test.js → test/server/transpiler.test.js
Expand Up @@ -2,9 +2,8 @@ import { once } from "node:events";
import fs from "node:fs/promises";
import { constants as fsConstants } from "node:fs";

import { Transpiler } from "../src/transpiler.js";

import { withTemporaryFiles } from "./lib/with-temporary-files.js";
import { Transpiler } from "../../src/server/transpiler.js";
import { withTemporaryFiles } from "../lib/with-temporary-files.js";

const TYPESCRIPT_SOURCE = "const x:number = 1;\n";
const JAVASCRIPT_SOURCE = "var x = 1;\n";
Expand Down

0 comments on commit 8cd7d49

Please sign in to comment.