|
1 | 1 | defmodule ConfigCat.InMemoryCacheTest do
|
2 | 2 | use ExUnit.Case, async: true
|
3 | 3 |
|
4 |
| - alias ConfigCat.InMemoryCache, as: Cache |
| 4 | + alias ConfigCat.InMemoryCache |
5 | 5 |
|
6 | 6 | @cache_key "CACHE_KEY"
|
7 | 7 |
|
8 | 8 | setup do
|
9 |
| - Cache.clear() |
| 9 | + InMemoryCache.clear(@cache_key) |
10 | 10 |
|
11 | 11 | :ok
|
12 | 12 | end
|
13 | 13 |
|
14 | 14 | test "cache is initially empty" do
|
15 |
| - assert Cache.get(@cache_key) == {:error, :not_found} |
| 15 | + assert InMemoryCache.get(@cache_key) == {:error, :not_found} |
16 | 16 | end
|
17 | 17 |
|
18 | 18 | test "returns cached value" do
|
19 | 19 | entry = "serialized-cache-entry"
|
20 | 20 |
|
21 |
| - :ok = Cache.set(@cache_key, entry) |
| 21 | + :ok = InMemoryCache.set(@cache_key, entry) |
22 | 22 |
|
23 |
| - assert {:ok, ^entry} = Cache.get(@cache_key) |
| 23 | + assert {:ok, ^entry} = InMemoryCache.get(@cache_key) |
24 | 24 | end
|
25 | 25 |
|
26 | 26 | test "cache is empty after clearing" do
|
27 | 27 | entry = "serialized-cache-entry"
|
28 | 28 |
|
29 |
| - :ok = Cache.set(@cache_key, entry) |
| 29 | + :ok = InMemoryCache.set(@cache_key, entry) |
30 | 30 |
|
31 |
| - assert :ok = Cache.clear() |
32 |
| - assert Cache.get(@cache_key) == {:error, :not_found} |
| 31 | + assert :ok = InMemoryCache.clear(@cache_key) |
| 32 | + assert InMemoryCache.get(@cache_key) == {:error, :not_found} |
33 | 33 | end
|
34 | 34 | end
|
0 commit comments