Skip to content

Commit

Permalink
chore: adding some initial tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasgriffintn committed Mar 29, 2024
1 parent d7f0157 commit 0849327
Show file tree
Hide file tree
Showing 7 changed files with 418 additions and 8 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ Copy that token and set it as the value for an environment variable named `QUEUE

You'll also find an example project in the folder `./example`, set the variables `ACCOUNT_ID` and `QUEUE_ID` and then run this with the command `pnpm dev`.


## API

### `Consumer.create(options)`
Expand Down
File renamed without changes.
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,25 @@
"scripts": {
"clean": "rm -fr dist/*",
"compile": "tsc -b ./tsconfig.cjs.json ./tsconfig.esm.json",
"build": "npm run clean && npm run compile",
"build": "pnpm run clean && pnpm run compile",
"watch": "tsc --watch",
"prepublishOnly": "npm run build",
"prepublishOnly": "pnpm run build",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --fix",
"format": "prettier --log-level warn --write \"**/*.{js,json,jsx,md,ts,tsx,html}\"",
"format:check": "prettier --check \"**/*.{js,json,jsx,md,ts,tsx,html}\"",
"test": "echo \"Error: no test specified\" && exit 1",
"posttest": "npm run lint && npm run format:check",
"test:unit": "node --import tsx --test ./test/unit/*.test.ts",
"test": "pnpm run test:unit && pnpm run lint && pnpm run format:check",
"generate-docs": "typedoc",
"dev": "DEBUG=cloudflare-queue-consumer node ./example/index.js"
"dev": "DEBUG=cloudflare-queue-consumer tsx ./example/index.ts"
},
"devDependencies": {
"@types/node": "^20.11.25",
"eslint": "^8.57.0",
"eslint-config-iplayer": "^9.2.0",
"eslint-config-prettier": "^9.1.0",
"prettier": "^3.2.5",
"tsx": "^4.7.1",
"typedoc": "^0.25.12",
"typescript": "^5.4.2"
},
Expand Down
270 changes: 270 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export type UpdatableOptions =
| "batchSize"
| "pollingWaitTimeMs";


/**
* The options for the stop method.
*/
Expand Down
10 changes: 9 additions & 1 deletion src/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,15 @@ function assertOptions(options: ConsumerOptions): void {
});

if (options.batchSize) {
validateOption("batchSize", options.batchSize, false);
validateOption("batchSize", options.batchSize);
}

if (options.visibilityTimeoutMs) {
validateOption("visibilityTimeoutMs", options.visibilityTimeoutMs);
}

if (options.retryMessageDelay) {
validateOption("retryMessageDelay", options.retryMessageDelay);
}
}

Expand Down
Loading

0 comments on commit 0849327

Please sign in to comment.