@stanlemon/server 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stanlemon/server",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "A basic express web server setup.",
5
5
  "author": "Stan Lemon <stanlemon@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -13,7 +13,9 @@
13
13
  "scripts": {
14
14
  "start": "NODE_ENV=development nodemon ./app.js",
15
15
  "lint": "eslint --ext js,jsx,ts,tsx ./",
16
- "lint:format": "eslint --fix --ext js,jsx,ts,tsx ./"
16
+ "lint:format": "eslint --fix --ext js,jsx,ts,tsx ./",
17
+ "test": "NODE_OPTIONS=--experimental-vm-modules jest --detectOpenHandles",
18
+ "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --detectOpenHandles --watch"
17
19
  },
18
20
  "dependencies": {
19
21
  "compression": "^1.7.4",
@@ -21,7 +23,7 @@
21
23
  "express": "^4.17.3",
22
24
  "express-rate-limit": "^6.3.0",
23
25
  "helmet": "^5.0.2",
24
- "http-proxy-middleware": "^2.0.4",
26
+ "http-proxy-middleware": "^2.0.6",
25
27
  "joi": "^17.6.0",
26
28
  "lodash-es": "^4.17.21",
27
29
  "morgan": "^1.10.0"
@@ -0,0 +1,30 @@
1
+ import convertCase from "./convertCase";
2
+ import { snakeCase } from "lodash-es";
3
+
4
+ describe("convertCase()", () => {
5
+ const convert = (obj) => convertCase(obj, convert, snakeCase);
6
+
7
+ it("converts object keys", async () => {
8
+ expect(convert({ fooBar: true }, convertCase, snakeCase)).toEqual({
9
+ foo_bar: true,
10
+ });
11
+ });
12
+
13
+ it("converts an array of object keys", async () => {
14
+ expect(convert([{ fooBar: true }], convertCase, snakeCase)).toEqual([
15
+ {
16
+ foo_bar: true,
17
+ },
18
+ ]);
19
+ });
20
+
21
+ it("does not convert strings", async () => {
22
+ expect(convert("hereIsAString", convertCase, snakeCase)).toEqual(
23
+ "hereIsAString"
24
+ );
25
+ });
26
+
27
+ it("does not convert anything else", async () => {
28
+ expect(convert(true, convertCase, snakeCase)).toEqual(true);
29
+ });
30
+ });
@@ -0,0 +1,31 @@
1
+ import formatInput from "./formatInput";
2
+
3
+ describe("formatInput()", () => {
4
+ it("formats object keys", async () => {
5
+ expect(formatInput({ fooBar: true })).toEqual({
6
+ foo_bar: true,
7
+ });
8
+ });
9
+
10
+ it("formats an array of object keys", async () => {
11
+ expect(formatInput([{ fooBar: true }])).toEqual([
12
+ {
13
+ foo_bar: true,
14
+ },
15
+ ]);
16
+ });
17
+
18
+ it("does not formats strings", async () => {
19
+ expect(formatInput("hereIsAString")).toEqual("hereIsAString");
20
+ });
21
+
22
+ it("does not formats anything else", async () => {
23
+ expect(formatInput(true)).toEqual(true);
24
+ });
25
+
26
+ it("does not change already formatted object keys", async () => {
27
+ expect(formatInput({ foo_bar: true })).toEqual({
28
+ foo_bar: true,
29
+ });
30
+ });
31
+ });
@@ -0,0 +1,31 @@
1
+ import formatOutput from "./formatOutput";
2
+
3
+ describe("formatOutput()", () => {
4
+ it("formats object keys", async () => {
5
+ expect(formatOutput({ foo_bar: true })).toEqual({
6
+ fooBar: true,
7
+ });
8
+ });
9
+
10
+ it("formats an array of object keys", async () => {
11
+ expect(formatOutput([{ foo_bar: true }])).toEqual([
12
+ {
13
+ fooBar: true,
14
+ },
15
+ ]);
16
+ });
17
+
18
+ it("does not formats strings", async () => {
19
+ expect(formatOutput("hereIsAString")).toEqual("hereIsAString");
20
+ });
21
+
22
+ it("does not formats anything else", async () => {
23
+ expect(formatOutput(true)).toEqual(true);
24
+ });
25
+
26
+ it("does not change already formatted object keys", async () => {
27
+ expect(formatOutput({ fooBar: true })).toEqual({
28
+ fooBar: true,
29
+ });
30
+ });
31
+ });