-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update tests to have more coverage, clean thingsu p
- Loading branch information
1 parent
f450f57
commit f53e287
Showing
5 changed files
with
41 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Cache } from './cache'; | ||
|
||
describe('Cache', () => { | ||
let cache: Cache; | ||
|
||
beforeEach(() => { | ||
cache = new Cache(); | ||
}); | ||
|
||
it('should store and retrieve data', async () => { | ||
const key = 'test-key'; | ||
const value = { data: 'test-value' }; | ||
const ttl = 3600; // e.g., 1 hour | ||
await cache.set(key, JSON.stringify(value), ttl); | ||
const result = await cache.get(key); | ||
expect(JSON.parse(result!)).toEqual(value); | ||
}); | ||
|
||
it('should return null for nonexistent keys', async () => { | ||
const result = await cache.get('nonexistent-key'); | ||
expect(result).toBeNull(); | ||
}); | ||
|
||
// ... add more tests as needed ... | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters