hookshot/tests/config/config.ts
Will Hunt 819c089aa4
Update minimum Node version to 22 (#990)
* Update dependencies

* Node 22 is now the new minimum version.

* changelog.

* Begin porting eslint to new config format.

* Make linter happy.

* Update reqwest to fix SSL issue?

* Fix test types

* quick check on ubuntu LTS 24.04

* Change cache key

* update rust action

* revert mocha due to esminess

* Remove the only usage of pqueue

* Use babel for TS transformations to get around ESM import bug.

* Dependency bundle upgrade

* Drop babel, not actually used.

* lint

* lint

* update default config (mostly sections moving around)
2024-11-28 15:04:01 +00:00

90 lines
3.1 KiB
TypeScript

import { BridgeConfig } from "../../src/config/Config";
import { DefaultConfigRoot } from "../../src/config/Defaults";
import { expect } from "chai";
describe("Config/BridgeConfig", () => {
describe("will handle the legacy queue.monolitihc option", () => {
it("with no parameters", () => {
const config = new BridgeConfig({ ...DefaultConfigRoot, queue: {
monolithic: true
}});
expect(config.queue).to.be.undefined;
expect(config.cache?.redisUri).to.equal("redis://localhost:6379");
});
it("with a host parameter", () => {
const config = new BridgeConfig({ ...DefaultConfigRoot, queue: {
monolithic: true,
host: 'bark'
}});
expect(config.queue).to.be.undefined;
expect(config.cache?.redisUri).to.equal("redis://bark:6379");
});
it("with a port parameter", () => {
const config = new BridgeConfig({ ...DefaultConfigRoot, queue: {
monolithic: true,
port: 6379,
}});
expect(config.queue).to.be.undefined;
expect(config.cache?.redisUri).to.equal("redis://localhost:6379");
});
it("with a host and port parameter", () => {
const config = new BridgeConfig({ ...DefaultConfigRoot, queue: {
monolithic: true,
host: 'bark',
port: 6379,
}});
expect(config.queue).to.be.undefined;
expect(config.cache?.redisUri).to.equal("redis://bark:6379");
});
it("with monolithic disabled", () => {
const config = new BridgeConfig({
...DefaultConfigRoot,
encryption: undefined,
queue: {
monolithic: false
}
});
expect(config.queue).to.deep.equal({
monolithic: false,
});
expect(config.cache?.redisUri).to.equal("redis://localhost:6379");
});
});
describe("will handle the queue option", () => {
it("with redisUri", () => {
const config = new BridgeConfig({ ...DefaultConfigRoot,
encryption: undefined,
queue: {
redisUri: "redis://localhost:6379"
},
cache: undefined
});
expect(config.queue).to.deep.equal({
redisUri: "redis://localhost:6379"
});
expect(config.cache).to.be.undefined;
});
});
describe("will handle the cache option", () => {
it("with redisUri", () => {
const config = new BridgeConfig({
...DefaultConfigRoot,
cache: {
redisUri: "redis://localhost:6379"
},
queue: undefined,
});
expect(config.cache).to.deep.equal({
redisUri: "redis://localhost:6379"
});
expect(config.queue).to.be.undefined;
});
});
})