mirror of
https://github.com/tcgdex/javascript-sdk.git
synced 2025-04-22 02:42:08 +00:00
chore: remove unused tests
Signed-off-by: Avior <git@avior.me>
This commit is contained in:
parent
1f3aae5401
commit
b3ba7820a3
@ -1,54 +0,0 @@
|
||||
/// <reference types="jest" />
|
||||
|
||||
const { default: MemoryCache } = require("../src/Psr/SimpleCache/MemoryCache")
|
||||
|
||||
const TCGdex = require("../src/tcgdex").default
|
||||
|
||||
test('that cache store and get one element', async () => {
|
||||
const cache = new MemoryCache()
|
||||
cache.set('a', 'b')
|
||||
expect(cache.get('a')).toBe('b')
|
||||
})
|
||||
|
||||
test('that cache store and get multiple elements', async () => {
|
||||
const cache = new MemoryCache()
|
||||
cache.setMultiple({
|
||||
'a': 'b',
|
||||
'c': 'd'
|
||||
})
|
||||
expect(cache.getMultiple(['a', 'c'])).toStrictEqual({
|
||||
a: 'b',
|
||||
c: 'd'
|
||||
})
|
||||
})
|
||||
|
||||
test('cache expiration', async () => {
|
||||
const cache = new MemoryCache()
|
||||
cache.set('a', 'b', 1)
|
||||
// wait 2 secs
|
||||
await new Promise((res) => setTimeout(res, 2000))
|
||||
expect(cache.get('a')).toBeUndefined()
|
||||
})
|
||||
|
||||
test('cache deletion', async () => {
|
||||
const cache = new MemoryCache()
|
||||
cache.set('a', 'b')
|
||||
expect(cache.get('a')).toBe('b')
|
||||
cache.delete('a')
|
||||
expect(cache.get('a')).toBeUndefined()
|
||||
})
|
||||
|
||||
test('cache cleared', async () => {
|
||||
const cache = new MemoryCache()
|
||||
cache.set('a', 'b')
|
||||
expect(cache.get('a')).toBe('b')
|
||||
cache.clear()
|
||||
expect(cache.get('a')).toBeUndefined()
|
||||
})
|
||||
|
||||
test('cache exists', async () => {
|
||||
const cache = new MemoryCache()
|
||||
expect(cache.has('a')).toBe(false)
|
||||
cache.set('a', 'b')
|
||||
expect(cache.has('a')).toBe(true)
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user