From f1d9c6fe101a7bc585dafe3a8111d6c8bdcbe21c Mon Sep 17 00:00:00 2001 From: Silas Sewell Date: Fri, 18 Oct 2024 17:27:40 -0600 Subject: [PATCH] Release version 2.0.0 --- .github/workflows/nodejs.yml | 32 ++++++++----- .gitignore | 1 + lib/catalog.js | 2 +- lib/health.d.ts | 2 +- lib/health.js | 2 +- lib/kv.d.ts | 2 +- lib/kv.js | 2 +- lib/transaction.d.ts | 2 +- lib/transaction.js | 6 +-- lib/utils.js | 8 ++-- lib/watch.js | 4 +- package.json | 17 ++++--- test/acceptance/agent.js | 18 +++---- test/acceptance/catalog.js | 4 +- test/acceptance/event.js | 4 +- test/acceptance/health.js | 2 +- test/acceptance/helper.js | 4 +- test/acceptance/kv.js | 12 ++--- test/acceptance/session.js | 8 ++-- test/acceptance/transaction.js | 4 +- test/acceptance/watch.js | 4 +- test/acl.js | 8 ++-- test/agent.js | 28 +++++------ test/catalog.js | 10 ++-- test/consul.js | 12 ++--- test/event.js | 2 +- test/health.js | 10 ++-- test/kv.js | 2 +- test/query.js | 14 +++--- test/session.js | 8 ++-- test/transaction.js | 4 +- test/utils.js | 88 +++++++++++++++++----------------- test/watch.js | 4 +- 33 files changed, 169 insertions(+), 161 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 68b0f5c..7a5a898 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -12,25 +12,33 @@ concurrency: group: ${{ github.ref }} cancel-in-progress: true +env: + CI: true + jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest strategy: matrix: - node-version: [16.x, 18.x, 20.x] + node-version: [18, 20] steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - - name: npm install, build, and test - run: | - npm install - npm run build --if-present - npm test - npm run types - env: - CI: true + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Install + run: pnpm install + + - name: Test + run: pnpm test diff --git a/.gitignore b/.gitignore index 50abf81..84444c9 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ coverage example*.js node_modules package-lock.json +pnpm-lock.yaml tmp diff --git a/lib/catalog.js b/lib/catalog.js index c754634..9138df0 100644 --- a/lib/catalog.js +++ b/lib/catalog.js @@ -58,7 +58,7 @@ class Catalog { if (!opts.node || !opts.address) { throw this.consul._err( errors.Validation("node and address required"), - req + req, ); } diff --git a/lib/health.d.ts b/lib/health.d.ts index 5e4b570..e87b57d 100644 --- a/lib/health.d.ts +++ b/lib/health.d.ts @@ -72,6 +72,6 @@ declare class Health { state(options: StateOptions): Promise; state( - state: "any" | "passing" | "warning" | "critical" + state: "any" | "passing" | "warning" | "critical", ): Promise; } diff --git a/lib/health.js b/lib/health.js index 0b92df6..fbdbaf2 100644 --- a/lib/health.js +++ b/lib/health.js @@ -113,7 +113,7 @@ class Health { if (opts.state !== "any" && constants.CHECK_STATE.indexOf(opts.state) < 0) { throw this.consul._err( errors.Validation("state invalid: " + opts.state), - req + req, ); } diff --git a/lib/kv.d.ts b/lib/kv.d.ts index df8c704..da05f05 100644 --- a/lib/kv.d.ts +++ b/lib/kv.d.ts @@ -72,7 +72,7 @@ declare class Kv { set( key: string, value: string | Buffer, - options: SetOptions + options: SetOptions, ): Promise; del(options: DelOptions): Promise; diff --git a/lib/kv.js b/lib/kv.js index dd672f9..791d8ff 100644 --- a/lib/kv.js +++ b/lib/kv.js @@ -60,7 +60,7 @@ class Kv { return next( false, undefined, - utils.responseResult(request, res.body[0]) + utils.responseResult(request, res.body[0]), ); } diff --git a/lib/transaction.d.ts b/lib/transaction.d.ts index c06f72f..e22ec5c 100644 --- a/lib/transaction.d.ts +++ b/lib/transaction.d.ts @@ -45,6 +45,6 @@ declare class Transaction { create(options: CreateOptions): Promise; create( operations: Operation[], - options: CreateOptions + options: CreateOptions, ): Promise; } diff --git a/lib/transaction.js b/lib/transaction.js index 51dc694..a3cb8d8 100644 --- a/lib/transaction.js +++ b/lib/transaction.js @@ -24,9 +24,9 @@ class Transaction { default: throw this.consul._err( errors.Validation( - "a list of operations are required as first arguments" + "a list of operations are required as first arguments", ), - { name: "Transaction.create" } + { name: "Transaction.create" }, ); } @@ -45,7 +45,7 @@ class Transaction { if (!(Array.isArray(opts.operations) && opts.operations.length > 0)) { throw this.consul._err( errors.Validation("operations must be an array with at least one item"), - req + req, ); } diff --git a/lib/utils.js b/lib/utils.js index 3f0c822..b9dc4be 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -361,7 +361,7 @@ function _createServiceCheck(src) { if (src.hasOwnProperty("aliasservice")) dst.AliasService = src.aliasservice; } else { throw new Error( - "args/grpc/h2ping/http/tcp/udp and interval, ttl, or aliasnode/aliasservice" + "args/grpc/h2ping/http/tcp/udp and interval, ttl, or aliasnode/aliasservice", ); } if (src.hasOwnProperty("notes")) dst.Notes = src.notes; @@ -438,7 +438,7 @@ function _createService(src, isSidecar) { if (!isSidecar) { dst.Connect.SidecarService = _createService( normalizeKeys(connect.sidecarservice), - true + true, ); } else { throw new Error("sidecarservice cannot be nested"); @@ -452,7 +452,7 @@ function _createService(src, isSidecar) { if (src.taggedaddresses) { dst.TaggedAddresses = _createTaggedAddresses( - normalizeKeys(src.taggedaddresses) + normalizeKeys(src.taggedaddresses), ); } @@ -544,7 +544,7 @@ function _createCatalogRegistration(src) { if (src.taggedaddresses) { dst.TaggedAddresses = _createTaggedAddresses( - normalizeKeys(src.taggedaddresses) + normalizeKeys(src.taggedaddresses), ); } diff --git a/lib/watch.js b/lib/watch.js index 4e75510..e4c965d 100644 --- a/lib/watch.js +++ b/lib/watch.js @@ -129,7 +129,7 @@ class Watch extends events.EventEmitter { this._run(); }, this, - this._wait() + this._wait(), ); } @@ -157,7 +157,7 @@ class Watch extends events.EventEmitter { if (newIndex === 0n) { return this._err( errors.Consul("Consul returned zero index value"), - res + res, ); } diff --git a/package.json b/package.json index dfee797..c090e5f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "consul", - "version": "2.0.0-next.3", + "version": "2.0.0", "description": "Consul client", "main": "./lib", "types": "./lib/index.d.ts", @@ -8,21 +8,20 @@ "./lib" ], "dependencies": { - "papi": "^1.1.0" + "papi": "^1.1.0", + "uuid": "^10.0.0" }, "devDependencies": { - "@definitelytyped/dtslint": "^0.0.159", - "@types/node": "*", + "@types/node": "^22.7.6", "async": "^3.2.0", "debug": "^4.3.1", "jshint": "^2.5.5", - "mocha": "^8.3.0", + "mocha": "^10.7.3", "nock": "^13.0.7", - "node-uuid": "^1.4.3", - "nyc": "^15.1.0", - "prettier": "^2.7.1", + "nyc": "^17.1.0", + "prettier": "^3.3.3", "should": "^13.2.1", - "sinon": "^9.2.4", + "sinon": "^19.0.2", "temp": "^0.9.4" }, "scripts": { diff --git a/test/acceptance/agent.js b/test/acceptance/agent.js index 404213b..b2fcfa6 100644 --- a/test/acceptance/agent.js +++ b/test/acceptance/agent.js @@ -2,7 +2,7 @@ const async_ = require("async"); const should = require("should"); -const uuid = require("node-uuid"); +const uuid = require("uuid"); const constants = require("../../lib/constants"); @@ -26,7 +26,7 @@ helper.describe("Agent", function () { should( data.map((m) => { return m.Name; - }) + }), ).containEql("node1"); }); }); @@ -61,7 +61,7 @@ helper.describe("Agent", function () { should(enableStatus).have.property("_node_maintenance"); should(enableStatus._node_maintenance).have.property( "Status", - "critical" + "critical", ); await this.c1.agent.maintenance({ enable: false }); @@ -77,7 +77,7 @@ helper.describe("Agent", function () { } catch (err) { should(err).have.property( "message", - "consul: agent.maintenance: enable required" + "consul: agent.maintenance: enable required", ); } }); @@ -106,7 +106,7 @@ helper.describe("Agent", function () { } catch (err) { should(err).have.property( "message", - "consul: agent.join: address required" + "consul: agent.join: address required", ); } }); @@ -138,7 +138,7 @@ helper.describe("Agent", function () { } catch (err) { should(err).have.property( "message", - "consul: agent.forceLeave: node required" + "consul: agent.forceLeave: node required", ); } }); @@ -171,7 +171,7 @@ helper.describe("Agent", function () { const checks = await this.c1.agent.checks(); await Promise.all( - Object.keys(checks).map((id) => this.c1.agent.check.deregister(id)) + Object.keys(checks).map((id) => this.c1.agent.check.deregister(id)), ); await this.c1.agent.check.register({ name: this.name, ttl: "10s" }); @@ -179,7 +179,7 @@ helper.describe("Agent", function () { afterEach(async function () { await Promise.all( - this.deregister.map((id) => this.c1.agent.check.deregister(id)) + this.deregister.map((id) => this.c1.agent.check.deregister(id)), ).catch(() => null); }); @@ -266,7 +266,7 @@ helper.describe("Agent", function () { afterEach(async function () { await Promise.all( - this.deregister.map((id) => this.c1.agent.service.deregister(id)) + this.deregister.map((id) => this.c1.agent.service.deregister(id)), ).catch(() => null); }); diff --git a/test/acceptance/catalog.js b/test/acceptance/catalog.js index 7a48db0..b666a95 100644 --- a/test/acceptance/catalog.js +++ b/test/acceptance/catalog.js @@ -2,7 +2,7 @@ const async_ = require("async"); const should = require("should"); -const uuid = require("node-uuid"); +const uuid = require("uuid"); const helper = require("./helper"); @@ -63,7 +63,7 @@ helper.describe("Catalog", function () { should(data.Services[this.service.name]).have.properties( "ID", "Service", - "Tags" + "Tags", ); should(data.Services[this.service.name].Service).eql(this.service.name); should(data.Services[this.service.name].Tags).eql([this.service.tag]); diff --git a/test/acceptance/event.js b/test/acceptance/event.js index b76a7a4..603fae5 100644 --- a/test/acceptance/event.js +++ b/test/acceptance/event.js @@ -1,7 +1,7 @@ "use strict"; const should = require("should"); -const uuid = require("node-uuid"); +const uuid = require("uuid"); const helper = require("./helper"); @@ -33,7 +33,7 @@ helper.describe("Event", function () { "ServiceFilter", "TagFilter", "Version", - "LTime" + "LTime", ); should(event.Name).equal("test"); }); diff --git a/test/acceptance/health.js b/test/acceptance/health.js index 1210bc7..ed1342a 100644 --- a/test/acceptance/health.js +++ b/test/acceptance/health.js @@ -2,7 +2,7 @@ const async_ = require("async"); const should = require("should"); -const uuid = require("node-uuid"); +const uuid = require("uuid"); const helper = require("./helper"); diff --git a/test/acceptance/helper.js b/test/acceptance/helper.js index 1109db9..2d87b0b 100644 --- a/test/acceptance/helper.js +++ b/test/acceptance/helper.js @@ -68,7 +68,7 @@ class Cluster { }; await util.promisify(fs.writeFile)( serverConfigPath, - JSON.stringify(serverConfig) + JSON.stringify(serverConfig), ); args.push("-config-file"); @@ -94,7 +94,7 @@ class Cluster { server.on("exit", (code) => { if (code !== 0 && !server._destroyed) { const err = new Error( - "Server exited (" + opts.node + "): " + code + "\n" + "Server exited (" + opts.node + "): " + code + "\n", ); err.message += "Command: " + binPath + " " + JSON.stringify(args); throw err; diff --git a/test/acceptance/kv.js b/test/acceptance/kv.js index 1fa8847..21cfdfb 100644 --- a/test/acceptance/kv.js +++ b/test/acceptance/kv.js @@ -33,7 +33,7 @@ helper.describe("Kv", function () { "LockIndex", "Key", "Flags", - "Value" + "Value", ); should(data.Key).eql(this.key); should(data.Flags).eql(0); @@ -62,7 +62,7 @@ helper.describe("Kv", function () { "LockIndex", "Key", "Flags", - "Value" + "Value", ); should(item.Key).eql(this.key); should(item.Flags).eql(0); @@ -103,7 +103,7 @@ helper.describe("Kv", function () { should(data).eql( this.keys.filter((key) => { return key.match(/^a/); - }) + }), ); }); @@ -123,7 +123,7 @@ helper.describe("Kv", function () { }) .map(function (v) { return v.slice(0, 4); - }) + }), ); }); @@ -151,7 +151,7 @@ helper.describe("Kv", function () { "LockIndex", "Key", "Flags", - "Value" + "Value", ); should(data.Value).eql(value); }); @@ -171,7 +171,7 @@ helper.describe("Kv", function () { "LockIndex", "Key", "Flags", - "Value" + "Value", ); should(data.Value).be.null(); }); diff --git a/test/acceptance/session.js b/test/acceptance/session.js index 9abf30b..f9d6de8 100644 --- a/test/acceptance/session.js +++ b/test/acceptance/session.js @@ -54,7 +54,7 @@ helper.describe("Session", function () { "NodeChecks", "LockDelay", "Behavior", - "TTL" + "TTL", ); }); }); @@ -75,7 +75,7 @@ helper.describe("Session", function () { "NodeChecks", "LockDelay", "Behavior", - "TTL" + "TTL", ); } }); @@ -104,7 +104,7 @@ helper.describe("Session", function () { "NodeChecks", "LockDelay", "Behavior", - "TTL" + "TTL", ); } }); @@ -126,7 +126,7 @@ helper.describe("Session", function () { "NodeChecks", "LockDelay", "Behavior", - "TTL" + "TTL", ); }); }); diff --git a/test/acceptance/transaction.js b/test/acceptance/transaction.js index 3e56dab..6ae861b 100644 --- a/test/acceptance/transaction.js +++ b/test/acceptance/transaction.js @@ -59,14 +59,14 @@ helper.describe("Transaction", function () { "ModifyIndex", "LockIndex", "Key", - "Flags" + "Flags", ); should(results[1].KV).have.keys( "CreateIndex", "ModifyIndex", "LockIndex", "Key", - "Flags" + "Flags", ); const data1 = await this.c1.kv.get(key1); diff --git a/test/acceptance/watch.js b/test/acceptance/watch.js index f989d10..d3711c6 100644 --- a/test/acceptance/watch.js +++ b/test/acceptance/watch.js @@ -58,7 +58,7 @@ helper.describe("Watch", function () { }, (next) => { setTimeout(next, 50); - } + }, ); const values = changes.map((data) => data && data.Value); @@ -98,7 +98,7 @@ helper.describe("Watch", function () { }, (next) => { setTimeout(next, 50); - } + }, ); should(watch).have.property("_attempts", 0); diff --git a/test/acl.js b/test/acl.js index 6868317..06e61a3 100644 --- a/test/acl.js +++ b/test/acl.js @@ -74,7 +74,7 @@ describe("Acl", function () { } catch (err) { should(err).have.property( "message", - "consul: acl.legacy.update: id required" + "consul: acl.legacy.update: id required", ); should(err).have.property("isValidation", true); } @@ -101,7 +101,7 @@ describe("Acl", function () { } catch (err) { should(err).have.property( "message", - "consul: acl.legacy.destroy: id required" + "consul: acl.legacy.destroy: id required", ); should(err).have.property("isValidation", true); } @@ -137,7 +137,7 @@ describe("Acl", function () { } catch (err) { should(err).have.property( "message", - "consul: acl.legacy.info: id required" + "consul: acl.legacy.info: id required", ); should(err).have.property("isValidation", true); } @@ -166,7 +166,7 @@ describe("Acl", function () { } catch (err) { should(err).have.property( "message", - "consul: acl.legacy.clone: id required" + "consul: acl.legacy.clone: id required", ); should(err).have.property("isValidation", true); } diff --git a/test/agent.js b/test/agent.js index 5b8d670..34b1d2d 100644 --- a/test/agent.js +++ b/test/agent.js @@ -114,7 +114,7 @@ describe("Agent", function () { should(err).property( "message", "consul: agent.check.register: args/grpc/h2ping/http/tcp/udp and interval, " + - "ttl, or aliasnode/aliasservice" + "ttl, or aliasnode/aliasservice", ); } }); @@ -129,7 +129,7 @@ describe("Agent", function () { } catch (err) { should(err).property( "message", - "consul: agent.check.register: name required" + "consul: agent.check.register: name required", ); } }); @@ -155,7 +155,7 @@ describe("Agent", function () { } catch (err) { should(err).property( "message", - "consul: agent.check.deregister: id required" + "consul: agent.check.deregister: id required", ); } }); @@ -184,7 +184,7 @@ describe("Agent", function () { } catch (err) { should(err).property( "message", - "consul: agent.check.pass: id required" + "consul: agent.check.pass: id required", ); } }); @@ -213,7 +213,7 @@ describe("Agent", function () { } catch (err) { should(err).property( "message", - "consul: agent.check.warn: id required" + "consul: agent.check.warn: id required", ); } }); @@ -242,7 +242,7 @@ describe("Agent", function () { } catch (err) { should(err).property( "message", - "consul: agent.check.fail: id required" + "consul: agent.check.fail: id required", ); } }); @@ -301,7 +301,7 @@ describe("Agent", function () { should(err).property( "message", "consul: agent.service.register: args/grpc/h2ping/http/tcp/udp and interval, " + - "ttl, or aliasnode/aliasservice" + "ttl, or aliasnode/aliasservice", ); } }); @@ -312,7 +312,7 @@ describe("Agent", function () { } catch (err) { should(err).property( "message", - "consul: agent.service.register: name required" + "consul: agent.service.register: name required", ); } }); @@ -337,7 +337,7 @@ describe("Agent", function () { } catch (err) { should(err).property( "message", - "consul: agent.service.deregister: id required" + "consul: agent.service.deregister: id required", ); } }); @@ -371,7 +371,7 @@ describe("Agent", function () { } catch (err) { should(err).have.property( "message", - "consul: agent.service.maintenance: id required" + "consul: agent.service.maintenance: id required", ); should(err).have.property("isValidation", true); } @@ -384,7 +384,7 @@ describe("Agent", function () { } catch (err) { should(err).have.property( "message", - "consul: agent.service.maintenance: enable required" + "consul: agent.service.maintenance: enable required", ); should(err).have.property("isValidation", true); } @@ -457,7 +457,7 @@ describe("Agent", function () { } catch (err) { should(err).have.property( "message", - "consul: agent.maintenance: enable required" + "consul: agent.maintenance: enable required", ); should(err).have.property("isValidation", true); } @@ -484,7 +484,7 @@ describe("Agent", function () { } catch (err) { should(err).have.property( "message", - "consul: agent.join: address required" + "consul: agent.join: address required", ); should(err).have.property("isValidation", true); } @@ -511,7 +511,7 @@ describe("Agent", function () { } catch (err) { should(err).have.property( "message", - "consul: agent.forceLeave: node required" + "consul: agent.forceLeave: node required", ); should(err).have.property("isValidation", true); } diff --git a/test/catalog.js b/test/catalog.js index eff76e9..0a2ca6a 100644 --- a/test/catalog.js +++ b/test/catalog.js @@ -29,7 +29,7 @@ describe("Catalog", function () { } catch (err) { should(err).property( "message", - "consul: catalog.register: node and address required" + "consul: catalog.register: node and address required", ); } }); @@ -55,7 +55,7 @@ describe("Catalog", function () { } catch (err) { should(err).property( "message", - "consul: catalog.deregister: node required" + "consul: catalog.deregister: node required", ); } }); @@ -146,7 +146,7 @@ describe("Catalog", function () { } catch (err) { should(err).property( "message", - "consul: catalog.node.services: node required" + "consul: catalog.node.services: node required", ); } }); @@ -229,7 +229,7 @@ describe("Catalog", function () { } catch (err) { should(err).property( "message", - "consul: catalog.service.nodes: service required" + "consul: catalog.service.nodes: service required", ); } }); @@ -251,7 +251,7 @@ describe("Catalog", function () { } catch (err) { should(err).property( "message", - "consul: catalog.connect.nodes: service required" + "consul: catalog.connect.nodes: service required", ); } }); diff --git a/test/consul.js b/test/consul.js index 3b7b6be..9a64dd3 100644 --- a/test/consul.js +++ b/test/consul.js @@ -15,7 +15,7 @@ describe("Consul", function () { should(helper.consul()).not.have.property("_defaults"); should(helper.consul({ defaults: { foo: "bar" } })).not.have.property( - "_defaults" + "_defaults", ); should(helper.consul({ defaults: { token: "123" } })) @@ -27,7 +27,7 @@ describe("Consul", function () { should( helper.consul({ defaults: { token: "123", dc: "test", foo: "bar" }, - }) + }), ) .have.property("_defaults") .eql({ @@ -47,7 +47,7 @@ describe("Consul", function () { host: "127.0.0.2", port: "8501", secure: true, - })._opts.baseUrl + })._opts.baseUrl, ).eql({ protocol: "https:", port: "8501", @@ -58,7 +58,7 @@ describe("Consul", function () { should( helper.consul({ baseUrl: "https://user:pass@example.org:8502/proxy/v1", - })._opts.baseUrl + })._opts.baseUrl, ).eql({ protocol: "https:", auth: "user:pass", @@ -75,7 +75,7 @@ describe("Consul", function () { should( helper.consul({ agent, - })._opts.agent + })._opts.agent, ).equal(agent); }); @@ -116,7 +116,7 @@ describe("Consul", function () { "x-consul-knownleader": "true", "x-consul-translate-addresses": "true", }, - }) + }), ).eql({ LastIndex: "5", LastContact: 100, diff --git a/test/event.js b/test/event.js index a55e61f..f95cc27 100644 --- a/test/event.js +++ b/test/event.js @@ -48,7 +48,7 @@ describe("Event", function () { } catch (err) { should(err).have.property( "message", - "consul: event.fire: name required" + "consul: event.fire: name required", ); } }); diff --git a/test/health.js b/test/health.js index ad3ffe1..e9d4257 100644 --- a/test/health.js +++ b/test/health.js @@ -29,7 +29,7 @@ describe("Health", function () { } catch (err) { should(err).have.property( "message", - "consul: health.node: node required" + "consul: health.node: node required", ); } }); @@ -57,7 +57,7 @@ describe("Health", function () { } catch (err) { should(err).have.property( "message", - "consul: health.checks: service required" + "consul: health.checks: service required", ); } }); @@ -91,7 +91,7 @@ describe("Health", function () { } catch (err) { should(err).have.property( "message", - "consul: health.service: service required" + "consul: health.service: service required", ); } }); @@ -119,7 +119,7 @@ describe("Health", function () { } catch (err) { should(err).have.property( "message", - "consul: health.state: state required" + "consul: health.state: state required", ); } }); @@ -131,7 +131,7 @@ describe("Health", function () { } catch (err) { should(err).have.property( "message", - "consul: health.state: state invalid: foo" + "consul: health.state: state invalid: foo", ); } }); diff --git a/test/kv.js b/test/kv.js index 74af6fb..91f52e4 100644 --- a/test/kv.js +++ b/test/kv.js @@ -57,7 +57,7 @@ describe("Kv", function () { } catch (err) { should(err).have.property( "message", - "consul: kv.get: internal server error" + "consul: kv.get: internal server error", ); } }); diff --git a/test/query.js b/test/query.js index 18dbde8..63b7b76 100644 --- a/test/query.js +++ b/test/query.js @@ -97,7 +97,7 @@ describe("Query", function () { } catch (err) { should(err).have.property( "message", - "consul: query.create: service required" + "consul: query.create: service required", ); } }); @@ -118,7 +118,7 @@ describe("Query", function () { } catch (err) { should(err).have.property( "message", - "consul: query.get: query required" + "consul: query.get: query required", ); } }); @@ -183,7 +183,7 @@ describe("Query", function () { } catch (err) { should(err).have.property( "message", - "consul: query.update: query required" + "consul: query.update: query required", ); } }); @@ -195,7 +195,7 @@ describe("Query", function () { } catch (err) { should(err).have.property( "message", - "consul: query.update: service required" + "consul: query.update: service required", ); } }); @@ -215,7 +215,7 @@ describe("Query", function () { } catch (err) { should(err).have.property( "message", - "consul: query.destroy: query required" + "consul: query.destroy: query required", ); } }); @@ -235,7 +235,7 @@ describe("Query", function () { } catch (err) { should(err).have.property( "message", - "consul: query.execute: query required" + "consul: query.execute: query required", ); } }); @@ -255,7 +255,7 @@ describe("Query", function () { } catch (err) { should(err).have.property( "message", - "consul: query.explain: query required" + "consul: query.explain: query required", ); } }); diff --git a/test/session.js b/test/session.js index 6a418a7..8e64e6e 100644 --- a/test/session.js +++ b/test/session.js @@ -59,7 +59,7 @@ describe("Session", function () { } catch (err) { should(err).have.property( "message", - "consul: session.destroy: id required" + "consul: session.destroy: id required", ); should(err).have.property("isValidation", true); } @@ -95,7 +95,7 @@ describe("Session", function () { } catch (err) { should(err).have.property( "message", - "consul: session.info: id required" + "consul: session.info: id required", ); should(err).have.property("isValidation", true); } @@ -123,7 +123,7 @@ describe("Session", function () { } catch (err) { should(err).have.property( "message", - "consul: session.node: node required" + "consul: session.node: node required", ); should(err).have.property("isValidation", true); } @@ -167,7 +167,7 @@ describe("Session", function () { } catch (err) { should(err).have.property( "message", - "consul: session.renew: id required" + "consul: session.renew: id required", ); should(err).have.property("isValidation", true); } diff --git a/test/transaction.js b/test/transaction.js index 7d042b9..0fea574 100644 --- a/test/transaction.js +++ b/test/transaction.js @@ -135,7 +135,7 @@ describe("Transaction", function () { } catch (err) { should(err).have.property( "message", - "consul: Transaction.create: a list of operations are required as first arguments" + "consul: Transaction.create: a list of operations are required as first arguments", ); } }); @@ -147,7 +147,7 @@ describe("Transaction", function () { } catch (err) { should(err).have.property( "message", - "consul: Transaction.create: operations must be an array with at least one item" + "consul: Transaction.create: operations must be an array with at least one item", ); } }); diff --git a/test/utils.js b/test/utils.js index d21bebf..5b710fa 100644 --- a/test/utils.js +++ b/test/utils.js @@ -20,17 +20,17 @@ describe("utils", function () { should(utils.getAgent({})).be.undefined(); should(utils.getAgent("http://www.example.com")).be.instanceOf( - http.Agent + http.Agent, ); should(utils.getAgent(new URL("http://www.example.com"))).be.instanceOf( - http.Agent + http.Agent, ); should(utils.getAgent("https://www.example.com")).be.instanceOf( - https.Agent + https.Agent, ); should(utils.getAgent(new URL("https://www.example.com"))).be.instanceOf( - https.Agent + https.Agent, ); }); }); @@ -117,8 +117,8 @@ describe("utils", function () { { one: 1 }, { two: 2, one: "nope" }, { three: 3, two: "nope" }, - { three: "nope" } - ) + { three: "nope" }, + ), ).eql({ one: 1, two: 2, three: 3 }); }); }); @@ -140,8 +140,8 @@ describe("utils", function () { { headers: { hello: "headers" }, query: { hello: "query" }, - } - ) + }, + ), ).eql({ headers: { hello: "headers" }, query: { hello: "query" }, @@ -160,7 +160,7 @@ describe("utils", function () { filter: "Meta.env == qa", ctx: "ctx", timeout: 20, - }) + }), ).eql({ headers: { "x-consul-token": "token1", @@ -233,7 +233,7 @@ describe("utils", function () { should(utils.decode("aGVsbG8gd29ybGQ=")).equal("hello world"); should(utils.decode("aGVsbG8gd29ybGQ=", {})).equal("hello world"); should(utils.decode("aGVsbG8gd29ybGQ=", { buffer: true })).eql( - Buffer.from("hello world") + Buffer.from("hello world"), ); }); }); @@ -315,7 +315,7 @@ describe("utils", function () { throw new Error("should have been canceled"); }, this.ctx, - 10 + 10, ); this.ctx.on("cancel", () => { @@ -335,7 +335,7 @@ describe("utils", function () { done(); }, this.ctx, - 0 + 0, ); }); }); @@ -355,7 +355,7 @@ describe("utils", function () { failuresbeforewarning: 1, failuresbeforecritical: 2, successBeforePassing: 3, - }) + }), ).eql({ ID: "id", Name: "name", @@ -381,7 +381,7 @@ describe("utils", function () { notes: "SSH TCP on port 22", status: "passing", deregistercriticalserviceafter: "1h", - }) + }), ).eql({ ID: "id", Name: "name", @@ -403,7 +403,7 @@ describe("utils", function () { args: ["/usr/bin/true"], interval: "30s", timeout: "5s", - }) + }), ).eql({ Args: ["/usr/bin/true"], Interval: "30s", @@ -416,7 +416,7 @@ describe("utils", function () { interval: "30s", shell: "/bin/sh", dockercontainerid: "123", - }) + }), ).eql({ Script: "/usr/bin/true", Interval: "30s", @@ -431,7 +431,7 @@ describe("utils", function () { tlsservername: "server", tlsskipverify: true, outputmaxsize: 4096, - }) + }), ).eql({ GRPC: "localhost:50051", Interval: "5s", @@ -448,7 +448,7 @@ describe("utils", function () { header: { authorization: ["one"] }, method: "POST", interval: "5s", - }) + }), ).eql({ HTTP: "https://example.com/test", Body: "{}", @@ -462,7 +462,7 @@ describe("utils", function () { utils.createServiceCheck({ h2ping: "https://example.com/test", interval: "5s", - }) + }), ).eql({ H2Ping: "https://example.com/test", Interval: "5s", @@ -473,7 +473,7 @@ describe("utils", function () { h2ping: "http://example.com/test", h2pingusetls: false, interval: "5s", - }) + }), ).eql({ H2Ping: "http://example.com/test", Interval: "5s", @@ -485,7 +485,7 @@ describe("utils", function () { grpc: "localhost:50051", grpcusetls: true, interval: "10s", - }) + }), ).eql({ GRPC: "localhost:50051", GRPCUseTLS: true, @@ -496,7 +496,7 @@ describe("utils", function () { utils.createServiceCheck({ udp: "localhost:50051", interval: "10s", - }) + }), ).eql({ UDP: "localhost:50051", Interval: "10s", @@ -506,7 +506,7 @@ describe("utils", function () { utils.createServiceCheck({ tcp: "localhost:50051", interval: "10s", - }) + }), ).eql({ TCP: "localhost:50051", Interval: "10s", @@ -517,7 +517,7 @@ describe("utils", function () { tcp: "localhost:50051", interval: "10s", tcpusetls: true, - }) + }), ).eql({ TCP: "localhost:50051", Interval: "10s", @@ -527,7 +527,7 @@ describe("utils", function () { should( utils.createServiceCheck({ ttl: "15s", - }) + }), ).eql({ TTL: "15s", }); @@ -535,7 +535,7 @@ describe("utils", function () { should( utils.createServiceCheck({ aliasnode: "web1", - }) + }), ).eql({ AliasNode: "web1", }); @@ -543,7 +543,7 @@ describe("utils", function () { should( utils.createServiceCheck({ aliasservice: "web", - }) + }), ).eql({ AliasService: "web", }); @@ -556,9 +556,9 @@ describe("utils", function () { should(() => { utils.createCheck(); }).throw( - "args/grpc/h2ping/http/tcp/udp and interval, ttl, or aliasnode/aliasservice" + "args/grpc/h2ping/http/tcp/udp and interval, ttl, or aliasnode/aliasservice", ); - } + }, ); }); @@ -569,7 +569,7 @@ describe("utils", function () { node: "node", checkid: "check", serviceid: "service", - }) + }), ).eql({ Node: "node", CheckID: "check", @@ -627,7 +627,7 @@ describe("utils", function () { service: { id: "service" }, address: "10.0.0.1", skipnodeupdate: true, - }) + }), ).eql({ ID: "123", Node: "node", @@ -686,7 +686,7 @@ describe("utils", function () { port: 1234, }, address: "10.0.0.1", - }) + }), ).eql({ ID: "123", Node: "node", @@ -726,7 +726,7 @@ describe("utils", function () { should( utils.createCatalogRegistration({ taggedaddresses: {}, - }) + }), ).eql({ TaggedAddresses: {}, }); @@ -754,7 +754,7 @@ describe("utils", function () { }, address: "10.0.0.1", port: 80, - }) + }), ).eql({ ID: "123", Name: "service", @@ -777,7 +777,7 @@ describe("utils", function () { script: "true", interval: "5s", }, - }) + }), ).eql({ Name: "service", Check: { @@ -794,7 +794,7 @@ describe("utils", function () { ttl: "10s", notes: "ttl service check", }, - }) + }), ).eql({ ID: "123", Name: "service", @@ -812,7 +812,7 @@ describe("utils", function () { { ttl: "10s" }, { http: "http://127.0.0.1:8000", interval: "60s" }, ], - }) + }), ).eql({ ID: "123", Name: "service", @@ -827,7 +827,7 @@ describe("utils", function () { connect: { native: true, }, - }) + }), ).eql({ Connect: { Native: true, @@ -844,7 +844,7 @@ describe("utils", function () { }, }, }, - }) + }), ).eql({ Connect: { SidecarService: { @@ -865,7 +865,7 @@ describe("utils", function () { }, }, }, - }) + }), ).eql({ Connect: { SidecarService: { @@ -890,7 +890,7 @@ describe("utils", function () { expose: {}, }, }, - }) + }), ).eql({ Connect: { Proxy: { @@ -909,7 +909,7 @@ describe("utils", function () { should( utils.createService({ taggedaddresses: {}, - }) + }), ).eql({ TaggedAddresses: {}, }); @@ -920,7 +920,7 @@ describe("utils", function () { lan: {}, wan: {}, }, - }) + }), ).eql({ TaggedAddresses: { lan: {}, @@ -940,7 +940,7 @@ describe("utils", function () { port: 80, }, }, - }) + }), ).eql({ TaggedAddresses: { lan: { diff --git a/test/watch.js b/test/watch.js index 3519ae2..e498db7 100644 --- a/test/watch.js +++ b/test/watch.js @@ -97,7 +97,7 @@ describe("Watch", function () { should(errors).have.length(1); should(errors[0]).have.property( "message", - "consul: kv.get: internal server error" + "consul: kv.get: internal server error", ); break; case "15": @@ -119,7 +119,7 @@ describe("Watch", function () { should(errors).have.length(3); should(errors[1]).have.property( "message", - "Consul returned zero index value" + "Consul returned zero index value", ); safeDone();