Writing Integration Tests
What distributed systems concept is being tested here?
describe('Cache integration', () => {
let cache, db;
beforeAll(async () => {
cache = await Redis.connect();
db = await Database.connect();
});
test('should sync cache with database', async () => {
await db.set('key', 'value');
await syncCache();
const cachedValue = await cache.get('key');
expect(cachedValue).toBe('value');
await db.delete('key');
await syncCache();
const deletedValue = await cache.get('key');
expect(deletedValue).toBeNull();
});
});