From 0338c186f8036da91ae15ee0b7c73d767b7e9d1b Mon Sep 17 00:00:00 2001 From: Starman <30315137+Starman3787@users.noreply.github.com> Date: Fri, 15 Nov 2024 12:20:19 +0000 Subject: [PATCH] convert all objects to json --- src/managers/BaseCacheManager.js | 2 +- test/managers/BaseCacheManager.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/managers/BaseCacheManager.js b/src/managers/BaseCacheManager.js index e50f9555..15b03972 100644 --- a/src/managers/BaseCacheManager.js +++ b/src/managers/BaseCacheManager.js @@ -334,7 +334,7 @@ class BaseCacheManager { case TO_JSON_TYPES_ENUM.CACHE_FORMAT: case TO_JSON_TYPES_ENUM.DISCORD_FORMAT: default: { - return [...this.#cache.values()]; + return [...this.#cache.values()].map((value) => value.toJSON(format)); } } } diff --git a/test/managers/BaseCacheManager.js b/test/managers/BaseCacheManager.js index 0939d005..ee02e08a 100644 --- a/test/managers/BaseCacheManager.js +++ b/test/managers/BaseCacheManager.js @@ -241,7 +241,7 @@ describe("BaseCacheManager", function () { const baseCacheManager = new BaseCacheManager(client, { structureType: guildEmojisManager, }); - baseCacheManager.set("key", "value"); + baseCacheManager.set("key", { value: "value", toJSON: () => "value" }); expect(baseCacheManager.toJSON()).to.deep.equal(["value"]); }); });