mirror of
https://github.com/Cameri/nostream.git
synced 2025-09-20 04:20:52 +02:00
feat: massive update
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
This commit is contained in:
@@ -47,22 +47,4 @@ describe('getRemoteAddress', () => {
|
||||
)
|
||||
).to.equal(socketAddress)
|
||||
})
|
||||
|
||||
it('returns undefined if unable to find header', () => {
|
||||
expect(
|
||||
getRemoteAddress(
|
||||
{ ...request, socket: {} } as any,
|
||||
{ network: {} } as any,
|
||||
)
|
||||
).to.be.undefined
|
||||
})
|
||||
|
||||
it('returns undefined if header setting is unset', () => {
|
||||
expect(
|
||||
getRemoteAddress(
|
||||
{ ...request, socket: {} } as any,
|
||||
{} as any,
|
||||
)
|
||||
).to.be.undefined
|
||||
})
|
||||
})
|
||||
|
@@ -14,6 +14,9 @@ describe('SlidingWindowRateLimiter', () => {
|
||||
let addToSortedSetStub: Sinon.SinonStub
|
||||
let getRangeFromSortedSetStub: Sinon.SinonStub
|
||||
let setKeyExpiryStub: Sinon.SinonStub
|
||||
let getKeyStub: Sinon.SinonStub
|
||||
let hasKeyStub: Sinon.SinonStub
|
||||
let setKeyStub: Sinon.SinonStub
|
||||
|
||||
let sandbox: Sinon.SinonSandbox
|
||||
|
||||
@@ -24,11 +27,17 @@ describe('SlidingWindowRateLimiter', () => {
|
||||
addToSortedSetStub = sandbox.stub()
|
||||
getRangeFromSortedSetStub = sandbox.stub()
|
||||
setKeyExpiryStub = sandbox.stub()
|
||||
getKeyStub = sandbox.stub()
|
||||
hasKeyStub = sandbox.stub()
|
||||
setKeyStub = sandbox.stub()
|
||||
cache = {
|
||||
removeRangeByScoreFromSortedSet: removeRangeByScoreFromSortedSetStub,
|
||||
addToSortedSet: addToSortedSetStub,
|
||||
getRangeFromSortedSet: getRangeFromSortedSetStub,
|
||||
setKeyExpiry: setKeyExpiryStub,
|
||||
getKey: getKeyStub,
|
||||
hasKey: hasKeyStub,
|
||||
setKey: setKeyStub,
|
||||
}
|
||||
rateLimiter = new SlidingWindowRateLimiter(cache)
|
||||
})
|
||||
|
Reference in New Issue
Block a user