Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
Ron Masas authored and Ron Masas committed Jan 31, 2020
1 parent 1368857 commit 5b77e21
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adonis-throttle",
"version": "2.3.5",
"version": "2.3.6",
"description": "A rate limiter for Adonis 4.1",
"main": "src/Throttle.js",
"scripts": {
Expand Down
13 changes: 7 additions & 6 deletions test/ThrottleManagerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,26 @@ describe('ThrottleManager', () => {
before(() => {
ioc.singleton('Adonis/Src/Config', () => new Config())
ioc.singleton('Adonis/Addons/Redis', () => class Redis {
static namedConnection() {}
static namedConnection() { }
})
})

describe('#extend', () => {
it('should add a new driver when provided driver implementation extends Cache abstract class', () => {
class Memcached extends Cache {
get() {}
put() {}
increment() {}
incrementExpiration() {}
get() { }
put() { }
increment() { }
incrementExpiration() { }
secondsToExpiration() { }
}

manager.extend('memcached', Memcached)
assert(manager.makeDriverInstance('memcached') instanceof Memcached)
})

it('should throw TypeError when provided driver implementation doesn’t extend Cache abstract class', () => {
class Memcached {}
class Memcached { }
assert.throws(() => manager.extend('memcached', Memcached), TypeError)
})
})
Expand Down

0 comments on commit 5b77e21

Please sign in to comment.