Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
nknapp committed Apr 21, 2024
1 parent dae9410 commit 1493e33
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The [tests](./src/QueryBin.test.ts) give a broad overview over the functionality
example.

```typescript
import { QueryBin, QueryDefinition } from "..";
import { QueryBin, QueryDefinition } from "query-bin";
import { describe, expect, it } from "vitest";

type Method = "GET" | "PUT" | "POST" | "PATCH" | "DELETE";
Expand All @@ -49,14 +49,9 @@ function byMethodAndUrl(method: Method, url: string): QueryDefinition<Request> {
return {
queryAll: (items) =>
items.filter((item) => item.method === method && item.url.includes(url)),
onNoneFound: (all) =>
new Error(
`Could not find item with method ${method} and URL containing ${url}. All requests:\n\n${JSON.stringify(all, null, 2)}`,
),
onMultipleFound: (all, found) =>
new Error(
`Multiple items found method ${method} and URL containing ${url}. Found:\n\n${JSON.stringify(found, null, 2)}`,
),
serializeForErrorMessage: (item) => JSON.stringify(item, null, 2),
noneFoundMessage: `Could not find requests with method ${method} and URL containing ${url}.`,
multipleFoundMessage: `Multiple requests found method ${method} and URL containing ${url}.`,
};
}

Expand Down Expand Up @@ -99,3 +94,10 @@ Don't afraid to use this project even if the last commit is a long time ago. I t

If you like to help me maintain and update dependencies, please contact me. At the moment, I tend not to be very active
though.

## Funding :coffee:

You can support me at

- [Liberapay](https://de.liberapay.com/nils.knappmeier/)
- [Paypal](https://www.paypal.com/donate/?hosted_button_id=GB656ZSAEQEXN)
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"test": "vitest run && tsc",
"format": "prettier -w .",
"version": "node ./scripts/on-version-bump.js",
"postversion": "npm publish",
"postinstall": "./scripts/on-postinstall.sh"
},
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-readme.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from "fs/promises";
import packageJson from "../package.json" assert { type: "json" };
import { editFile } from "./tools/editFile.js";

const exampleTestTs = await fs.readFile("./src/example.test.ts", "utf-8");
const exampleTestTs = (await fs.readFile("./src/example.test.ts", "utf-8")).replace(`".."`,`"${packageJson.name}"`);

function fences(name, contents) {
return "```" + name + "\n" + contents + "\n```";
Expand Down

0 comments on commit 1493e33

Please sign in to comment.