Skip to content

Commit

Permalink
maint: fix spelling errors (#344)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `fixtureServereMiddleware` function was renamed to `fixtureServerMiddleware` to fix typo

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
  • Loading branch information
jsoref committed Feb 18, 2024
1 parent af706db commit ff4d2a0
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
14 changes: 7 additions & 7 deletions 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)

Expand Down Expand Up @@ -91,12 +91,12 @@ app.listen(3000);

#### Options

| Option | Default | Descriptio |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| `fixturesUrl` | `'http://localhost:<port>'` | 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:<port>'` | 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

Expand Down
8 changes: 4 additions & 4 deletions bin/server.js
Expand Up @@ -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";

Expand Down Expand Up @@ -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),
}),
);

Expand Down
4 changes: 2 additions & 2 deletions index.js
@@ -1,4 +1,4 @@
export default fixtureServereMiddleware;
export default fixtureServerMiddleware;

import { URL } from "url";

Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions lib/additions.js
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions 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);
Expand All @@ -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(), "."),
};

0 comments on commit ff4d2a0

Please sign in to comment.