From ff4d2a0e71d8f7bacee52101abe55befd72fe2c2 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Sun, 18 Feb 2024 11:28:09 -0500 Subject: [PATCH] maint: fix spelling errors (#344) BREAKING CHANGE: `fixtureServereMiddleware` function was renamed to `fixtureServerMiddleware` to fix typo Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- README.md | 14 +++++++------- bin/server.js | 8 ++++---- index.js | 4 ++-- lib/additions.js | 6 +++--- lib/defaults.js | 4 ++-- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 115d39e..e916c65 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # fixtures-server -> Fixtures server for browser & language agnositic octokit testing +> Fixtures server for browser & language agnostic octokit testing [![Test](https://github.com/octokit/fixtures-server/workflows/Test/badge.svg?branch=main)](https://github.com/octokit/fixtures-server/actions?query=workflow%3ATest+branch%3Amain) @@ -91,12 +91,12 @@ app.listen(3000); #### Options -| Option | Default | Descriptio | -| ------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | -| `fixturesUrl` | `'http://localhost:'` | URL to handle fixture requests (This helps with continuous deployments) | -| `logLevel` | `'info'` | One of `'debug'`, `'info'`, `'warn'`, `'error'`, `'silent'` | -| `ttl` | `60000` | Expiration time (time to live) for loaded fixtures in ms | -| `fixtures` | fixtures from [@octokit/fixtures/scenarios/api.github.com](https://github.com/octokit/fixtures/tree/main/scenarios/api.github.com) | Object with keysbeing the scenario names and values being the fixtures arrays | +| Option | Default | Description | +| ------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | +| `fixturesUrl` | `'http://localhost:'` | URL to handle fixture requests (This helps with continuous deployments) | +| `logLevel` | `'info'` | One of `'debug'`, `'info'`, `'warn'`, `'error'`, `'silent'` | +| `ttl` | `60000` | Expiration time (time to live) for loaded fixtures in ms | +| `fixtures` | fixtures from [@octokit/fixtures/scenarios/api.github.com](https://github.com/octokit/fixtures/tree/main/scenarios/api.github.com) | Object with keys being the scenario names and values being the fixtures arrays | ## License diff --git a/bin/server.js b/bin/server.js index c5dc302..f12bc3e 100755 --- a/bin/server.js +++ b/bin/server.js @@ -5,8 +5,8 @@ import express from "express"; import yargs from "yargs"; import { hideBin } from "yargs/helpers"; -import fixtureServereMiddleware from "../index.js"; -import globTofixtures from "../lib/glob-to-fixtures.js "; +import fixtureServerMiddleware from "../index.js"; +import globToFixtures from "../lib/glob-to-fixtures.js "; import DEFAULTS from "../lib/defaults.js"; @@ -48,12 +48,12 @@ app.get("/ping", (request, response) => { response.json({ ok: true }); }); app.use( - fixtureServereMiddleware({ + fixtureServerMiddleware({ port: argv.port, fixturesUrl: argv["fixtures-url"], logLevel: argv["log-level"], ttl: argv.ttl, - fixtures: globTofixtures(argv.fixtures), + fixtures: globToFixtures(argv.fixtures), }), ); diff --git a/index.js b/index.js index 5ad1729..ec69442 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -export default fixtureServereMiddleware; +export default fixtureServerMiddleware; import { URL } from "url"; @@ -14,7 +14,7 @@ import proxy from "./lib/proxy.js"; import DEFAULTS from "./lib/defaults.js"; -function fixtureServereMiddleware(options) { +function fixtureServerMiddleware(options) { const middleware = Router(); const state = _.defaults(_.clone(options), DEFAULTS); diff --git a/lib/additions.js b/lib/additions.js index 3763c3f..442abee 100644 --- a/lib/additions.js +++ b/lib/additions.js @@ -29,9 +29,9 @@ function fixtureAdditions(state, { id, fixture }) { // mocks loaded with nock as they are global for the same process. Looking up // fixtures by unique hostname is more efficient, too. const { protocol, hostname, port } = new URL(fixture.scope); - const newHostame = `fixtures-${id}.${hostname}`; - fixture.scope = `${protocol}//${newHostame}:${port}`; - fixture.reqheaders.host = newHostame; + const newHostname = `fixtures-${id}.${hostname}`; + fixture.scope = `${protocol}//${newHostname}:${port}`; + fixture.reqheaders.host = newHostname; return fixture; } diff --git a/lib/defaults.js b/lib/defaults.js index 64395c4..633ea13 100644 --- a/lib/defaults.js +++ b/lib/defaults.js @@ -1,5 +1,5 @@ import { dirname, resolve } from "path"; -import globTofixtures from "./glob-to-fixtures.js"; +import globToFixtures from "./glob-to-fixtures.js"; import { createRequire } from "module"; const require = createRequire(import.meta.url); @@ -15,6 +15,6 @@ export default { fixturesUrl: null, logLevel: "info", ttl: 60000, - fixtures: globTofixtures(DEFAULT_FIXTURES_GLOB), + fixtures: globToFixtures(DEFAULT_FIXTURES_GLOB), fixturesGlob: DEFAULT_FIXTURES_GLOB.replace(process.cwd(), "."), };