Skip to content

Commit 23fc025

Browse files
CLDSRV-741: Unit test config objectKeyByteLimit
1 parent 52540f0 commit 23fc025

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

tests/unit/Config.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,4 +922,33 @@ describe('Config', () => {
922922
}
923923
});
924924
});
925+
926+
describe('objectKeyByteLimit', () => {
927+
it('should use default objectKeyByteLimit (915) from arsenal constants', () => {
928+
const config = new ConfigObject();
929+
assert.strictEqual(config.objectKeyByteLimit, 915);
930+
});
931+
932+
it('should override objectKeyByteLimit from environment variable', () => {
933+
setEnv('OVERRIDE_OBJECT_KEY_BYTE_LIMIT', '2048');
934+
const config = new ConfigObject();
935+
assert.strictEqual(config.objectKeyByteLimit, 2048);
936+
});
937+
938+
it('should allow setting objectKeyByteLimit to 0 (no limit)', () => {
939+
setEnv('OVERRIDE_OBJECT_KEY_BYTE_LIMIT', '0');
940+
const config = new ConfigObject();
941+
assert.strictEqual(config.objectKeyByteLimit, 0);
942+
});
943+
944+
it('should throw error for negative objectKeyByteLimit override', () => {
945+
setEnv('OVERRIDE_OBJECT_KEY_BYTE_LIMIT', '-1');
946+
assert.throws(() => new ConfigObject());
947+
});
948+
949+
it('should throw error for invalid string objectKeyByteLimit override', () => {
950+
setEnv('OVERRIDE_OBJECT_KEY_BYTE_LIMIT', 'invalid');
951+
assert.throws(() => new ConfigObject());
952+
});
953+
});
925954
});

0 commit comments

Comments
 (0)