Compare commits

...

1 Commits

Author SHA1 Message Date
Matti Nannt
e5f1813b68 chore: Tweak formbricks JS log message
Update log messages in `packages/js-core/src/lib/common/setup.ts` to provide clearer information about survey fetching and filtering.

* **Log Messages:**
  - Update the log message to 'Fetched X surveys from the backend'.
  - Add a new log message 'Y surveys could be shown to current user on trigger'.

* **Tests:**
  - Update the test case in `packages/js-core/src/lib/common/tests/setup.test.ts` to check for the new log messages.
  - Add expectations for 'Fetched 0 surveys from the backend' and '0 surveys could be shown to current user on trigger'.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/formbricks/formbricks?shareId=XXXX-XXXX-XXXX-XXXX).
2025-05-16 11:52:32 +02:00
2 changed files with 6 additions and 1 deletions

View File

@@ -257,7 +257,8 @@ export const setup = async (
});
const surveyNames = filteredSurveys.map((s) => s.name);
logger.debug(`Fetched ${surveyNames.length.toString()} surveys during sync: ${surveyNames.join(", ")}`);
logger.debug(`Fetched ${environmentState.data.surveys.length.toString()} surveys from the backend`);
logger.debug(`${surveyNames.length.toString()} surveys could be shown to current user on trigger: ${surveyNames.join(", ")}`);
} catch {
logger.debug("Error during sync. Please try again.");
}

View File

@@ -198,6 +198,10 @@ describe("setup.ts", () => {
filteredSurveys: [{ name: "S1" }, { name: "S2" }],
})
);
// Check for the new log messages
expect(mockLogger.debug).toHaveBeenCalledWith("Fetched 0 surveys from the backend");
expect(mockLogger.debug).toHaveBeenCalledWith("0 surveys could be shown to current user on trigger: ");
});
test("resets config if no valid config found, fetches environment, sets default user", async () => {