Skip to content

Commit 46d88ea

Browse files
authored
chore: fixes dependabot warnings about packages (#40)
* dependabot warnings about packages * fix: tests: * fix: test
1 parent 42958bb commit 46d88ea

File tree

7 files changed

+1801
-1570
lines changed

7 files changed

+1801
-1570
lines changed

apps/playground/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
},
1212
"dependencies": {
1313
"@formbricks/react-native": "workspace:*",
14-
"@react-native-async-storage/async-storage": "2.1.2",
15-
"expo": "~53.0.13",
16-
"expo-status-bar": "~2.2.3",
17-
"react": "19.0.0",
18-
"react-native": "0.79.4"
14+
"@react-native-async-storage/async-storage": "2.2.0",
15+
"expo": "54.0.29",
16+
"expo-status-bar": "3.0.9",
17+
"react": "19.1.0",
18+
"react-native": "0.81.5"
1919
},
2020
"devDependencies": {
21-
"@babel/core": "^7.25.2",
22-
"@types/react": "~19.0.10",
23-
"typescript": "~5.8.3"
21+
"@babel/core": "7.28.5",
22+
"@types/react": "19.1.17",
23+
"typescript": "5.9.3"
2424
},
2525
"private": true
2626
}

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
},
2323
"pnpm": {
2424
"overrides": {
25-
"on-headers": ">=1.1.0"
25+
"on-headers": ">=1.1.0",
26+
"glob": ">=11.1.0",
27+
"node-forge": ">=1.3.2",
28+
"js-yaml": ">=4.1.1"
2629
}
2730
}
2831
}

packages/react-native/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@
4545
"zod": "3.25.67"
4646
},
4747
"devDependencies": {
48-
"@types/react": "19.0.14",
48+
"@types/react": "19.1.17",
4949
"@vercel/style-guide": "6.0.0",
50-
"@vitest/coverage-v8": "3.2.4",
51-
"react": "19.0.0",
52-
"react-native": "0.79.4",
53-
"terser": "5.37.0",
54-
"vite": "7.1.9",
50+
"@vitest/coverage-v8": "4.0.15",
51+
"react": "19.1.0",
52+
"react-native": "0.81.5",
53+
"terser": "5.44.1",
54+
"vite": "7.3.0",
5555
"vite-plugin-dts": "4.5.4",
56-
"vitest": "3.2.4"
56+
"vitest": "4.0.15"
5757
},
5858
"peerDependencies": {
5959
"@react-native-async-storage/async-storage": ">=2.1.0",

packages/react-native/src/lib/environment/tests/state.test.ts

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import {
2222

2323
// Mock the FormbricksAPI so we can control environment.getState
2424
vi.mock("@/lib/common/api", () => ({
25-
ApiClient: vi.fn().mockImplementation(() => ({
26-
getEnvironmentState: vi.fn(),
27-
})),
25+
ApiClient: vi.fn().mockImplementation(function () {
26+
return { getEnvironmentState: vi.fn() };
27+
}),
2828
}));
2929

3030
// Mock logger (so we don’t spam console)
@@ -70,7 +70,7 @@ describe("environment/state.ts", () => {
7070
describe("fetchEnvironmentState()", () => {
7171
test("returns ok(...) with environment state", async () => {
7272
// Setup mock
73-
(ApiClient as unknown as Mock).mockImplementationOnce(() => {
73+
(ApiClient as unknown as Mock).mockImplementationOnce(function () {
7474
return {
7575
getEnvironmentState: vi.fn().mockResolvedValue({
7676
ok: true,
@@ -103,7 +103,7 @@ describe("environment/state.ts", () => {
103103
message: "Access denied",
104104
};
105105

106-
(ApiClient as unknown as Mock).mockImplementationOnce(() => {
106+
(ApiClient as unknown as Mock).mockImplementationOnce(function () {
107107
return {
108108
getEnvironmentState: vi.fn().mockResolvedValue({
109109
ok: false,
@@ -131,7 +131,7 @@ describe("environment/state.ts", () => {
131131
responseMessage: "Network fail",
132132
};
133133

134-
(ApiClient as unknown as Mock).mockImplementationOnce(() => {
134+
(ApiClient as unknown as Mock).mockImplementationOnce(function () {
135135
return {
136136
getEnvironmentState: vi.fn().mockRejectedValue(mockNetworkError),
137137
};
@@ -208,12 +208,14 @@ describe("environment/state.ts", () => {
208208

209209
mockRNConfig.mockReturnValue(mockConfig as unknown as Promise<RNConfig>);
210210

211-
(ApiClient as Mock).mockImplementation(() => ({
212-
getEnvironmentState: vi.fn().mockResolvedValue({
213-
ok: true,
214-
data: mockNewState,
215-
}),
216-
}));
211+
(ApiClient as Mock).mockImplementation(function () {
212+
return {
213+
getEnvironmentState: vi.fn().mockResolvedValue({
214+
ok: true,
215+
data: mockNewState,
216+
}),
217+
};
218+
});
217219

218220
(filterSurveys as Mock).mockReturnValue([]);
219221

@@ -242,11 +244,13 @@ describe("environment/state.ts", () => {
242244
mockRNConfig.mockReturnValue(mockConfig as unknown as Promise<RNConfig>);
243245

244246
// Mock API to throw an error
245-
(ApiClient as Mock).mockImplementation(() => ({
246-
getEnvironmentState: vi
247-
.fn()
248-
.mockRejectedValue(new Error("Network error")),
249-
}));
247+
(ApiClient as Mock).mockImplementation(function () {
248+
return {
249+
getEnvironmentState: vi
250+
.fn()
251+
.mockRejectedValue(new Error("Network error")),
252+
};
253+
});
250254

251255
addEnvironmentStateExpiryCheckListener();
252256

@@ -272,9 +276,9 @@ describe("environment/state.ts", () => {
272276

273277
mockRNConfig.mockReturnValue(mockConfig as unknown as Promise<RNConfig>);
274278

275-
const apiMock = vi.fn().mockImplementation(() => ({
276-
getEnvironmentState: vi.fn(),
277-
}));
279+
const apiMock = vi.fn().mockImplementation(function () {
280+
return { getEnvironmentState: vi.fn() };
281+
});
278282

279283
(ApiClient as Mock).mockImplementation(apiMock);
280284

packages/react-native/src/lib/user/tests/update.test.ts

Lines changed: 64 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ vi.mock("@/lib/common/utils", () => ({
3333
}));
3434

3535
vi.mock("@/lib/common/api", () => ({
36-
ApiClient: vi.fn().mockImplementation(() => ({
37-
createOrUpdateUser: vi.fn(),
38-
})),
36+
ApiClient: vi.fn().mockImplementation(function () {
37+
return { createOrUpdateUser: vi.fn() };
38+
}),
3939
}));
4040

4141
describe("sendUpdatesToBackend", () => {
@@ -56,9 +56,9 @@ describe("sendUpdatesToBackend", () => {
5656
},
5757
};
5858

59-
(ApiClient as Mock).mockImplementation(() => ({
60-
createOrUpdateUser: vi.fn().mockResolvedValue(mockResponse),
61-
}));
59+
(ApiClient as Mock).mockImplementation(function () {
60+
return { createOrUpdateUser: vi.fn().mockResolvedValue(mockResponse) };
61+
});
6262

6363
const result = await sendUpdatesToBackend({
6464
appUrl: mockAppUrl,
@@ -68,19 +68,31 @@ describe("sendUpdatesToBackend", () => {
6868

6969
expect(result.ok).toBe(true);
7070
if (result.ok) {
71-
expect(result.data.state.data).toEqual({ userId: mockUserId, attributes: mockAttributes });
71+
expect(result.data.state.data).toEqual({
72+
userId: mockUserId,
73+
attributes: mockAttributes,
74+
});
7275
}
7376
});
7477

7578
test("returns network error if API call fails", async () => {
76-
const mockUpdates: TUpdates = { userId: mockUserId, attributes: mockAttributes };
79+
const mockUpdates: TUpdates = {
80+
userId: mockUserId,
81+
attributes: mockAttributes,
82+
};
7783

78-
(ApiClient as Mock).mockImplementation(() => ({
79-
createOrUpdateUser: vi.fn().mockResolvedValue({
80-
ok: false,
81-
error: { code: "network_error", message: "Request failed", status: 500 },
82-
}),
83-
}));
84+
(ApiClient as Mock).mockImplementation(function () {
85+
return {
86+
createOrUpdateUser: vi.fn().mockResolvedValue({
87+
ok: false,
88+
error: {
89+
code: "network_error",
90+
message: "Request failed",
91+
status: 500,
92+
},
93+
}),
94+
};
95+
});
8496

8597
const result = await sendUpdatesToBackend({
8698
appUrl: mockAppUrl,
@@ -91,16 +103,25 @@ describe("sendUpdatesToBackend", () => {
91103
expect(result.ok).toBe(false);
92104
if (!result.ok) {
93105
expect(result.error.code).toBe("network_error");
94-
expect(result.error.message).toBe("Error updating user with userId user_123");
106+
expect(result.error.message).toBe(
107+
"Error updating user with userId user_123"
108+
);
95109
}
96110
});
97111

98112
test("throws error if network request fails", async () => {
99-
const mockUpdates: TUpdates = { userId: mockUserId, attributes: { plan: "premium" } };
113+
const mockUpdates: TUpdates = {
114+
userId: mockUserId,
115+
attributes: { plan: "premium" },
116+
};
100117

101-
(ApiClient as Mock).mockImplementation(() => ({
102-
createOrUpdateUser: vi.fn().mockRejectedValue(new Error("Network error")),
103-
}));
118+
(ApiClient as Mock).mockImplementation(function () {
119+
return {
120+
createOrUpdateUser: vi
121+
.fn()
122+
.mockRejectedValue(new Error("Network error")),
123+
};
124+
});
104125

105126
await expect(
106127
sendUpdatesToBackend({
@@ -146,11 +167,13 @@ describe("sendUpdates", () => {
146167
},
147168
};
148169

149-
(ApiClient as Mock).mockImplementation(() => ({
150-
createOrUpdateUser: vi.fn().mockResolvedValue(mockResponse),
151-
}));
170+
(ApiClient as Mock).mockImplementation(function () {
171+
return { createOrUpdateUser: vi.fn().mockResolvedValue(mockResponse) };
172+
});
152173

153-
const result = await sendUpdates({ updates: { userId: mockUserId, attributes: mockAttributes } });
174+
const result = await sendUpdates({
175+
updates: { userId: mockUserId, attributes: mockAttributes },
176+
});
154177

155178
expect(result.ok).toBe(true);
156179
});
@@ -165,11 +188,15 @@ describe("sendUpdates", () => {
165188
},
166189
};
167190

168-
(ApiClient as Mock).mockImplementation(() => ({
169-
createOrUpdateUser: vi.fn().mockResolvedValue(mockErrorResponse),
170-
}));
191+
(ApiClient as Mock).mockImplementation(function () {
192+
return {
193+
createOrUpdateUser: vi.fn().mockResolvedValue(mockErrorResponse),
194+
};
195+
});
171196

172-
const result = await sendUpdates({ updates: { userId: mockUserId, attributes: mockAttributes } });
197+
const result = await sendUpdates({
198+
updates: { userId: mockUserId, attributes: mockAttributes },
199+
});
173200

174201
expect(result.ok).toBe(false);
175202
if (!result.ok) {
@@ -178,11 +205,17 @@ describe("sendUpdates", () => {
178205
});
179206

180207
test("handles unexpected errors", async () => {
181-
(ApiClient as Mock).mockImplementation(() => ({
182-
createOrUpdate: vi.fn().mockRejectedValue(new Error("Unexpected error")),
183-
}));
208+
(ApiClient as Mock).mockImplementation(function () {
209+
return {
210+
createOrUpdateUser: vi
211+
.fn()
212+
.mockRejectedValue(new Error("Unexpected error")),
213+
};
214+
});
184215

185-
const result = await sendUpdates({ updates: { userId: mockUserId, attributes: mockAttributes } });
216+
const result = await sendUpdates({
217+
updates: { userId: mockUserId, attributes: mockAttributes },
218+
});
186219

187220
expect(result.ok).toBe(false);
188221
if (!result.ok) {

packages/react-native/vite.config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { resolve } from "node:path";
2-
import { type UserConfig, defineConfig } from "vite";
2+
import { defineConfig } from "vite";
3+
import { ViteUserConfig } from "vitest/config";
34
import dts from "vite-plugin-dts";
45

5-
const config = (): UserConfig => {
6+
const config = (): ViteUserConfig => {
67
return defineConfig({
78
resolve: {
89
alias: {

0 commit comments

Comments
 (0)