@teardown/react-native 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  import { describe, test, expect, beforeEach, mock } from "bun:test";
2
2
  import { EventEmitter } from "eventemitter3";
3
+ import { ForceUpdateClient, IdentifyVersionStatusEnum } from "./force-update.client";
3
4
 
4
5
  // Must mock react-native BEFORE any imports that use it
5
6
  const mockAppStateListeners: ((state: string) => void)[] = [];
@@ -12,8 +13,6 @@ mock.module("react-native", () => ({
12
13
  },
13
14
  }));
14
15
 
15
- // Import after mock
16
- const { ForceUpdateClient, IdentifyVersionStatusEnum } = await import("./force-update.client");
17
16
  type IdentifyState = import("../identity").IdentifyState;
18
17
  type IdentifyStateChangeEvents = import("../identity").IdentifyStateChangeEvents;
19
18
  type VersionStatus = import("./force-update.client").VersionStatus;
@@ -52,10 +51,10 @@ function createMockIdentityClient() {
52
51
  function createMockLoggingClient() {
53
52
  return {
54
53
  createLogger: () => ({
55
- info: () => {},
56
- warn: () => {},
57
- error: () => {},
58
- debug: () => {},
54
+ info: () => { },
55
+ warn: () => { },
56
+ error: () => { },
57
+ debug: () => { },
59
58
  }),
60
59
  };
61
60
  }
@@ -266,8 +265,8 @@ describe("ForceUpdateClient", () => {
266
265
  [IdentifyVersionStatusEnum.UP_TO_DATE, "up_to_date"],
267
266
  [IdentifyVersionStatusEnum.UPDATE_AVAILABLE, "update_available"],
268
267
  [IdentifyVersionStatusEnum.UPDATE_REQUIRED, "update_required"],
269
- [IdentifyVersionStatusEnum.UPDATE_RECOMMENDED, "up_to_date"], // Falls through to default
270
- [IdentifyVersionStatusEnum.DISABLED, "up_to_date"], // Falls through to default
268
+ [IdentifyVersionStatusEnum.UPDATE_RECOMMENDED, "update_recommended"],
269
+ [IdentifyVersionStatusEnum.DISABLED, "disabled"],
271
270
  ])("maps %s to %s", (apiStatus, expectedType) => {
272
271
  const mockIdentity = createMockIdentityClient();
273
272
  const mockLogging = createMockLoggingClient();
@@ -184,6 +184,11 @@ export class IdentityClient {
184
184
  return this.tryCatch(async () => {
185
185
  const deviceId = await this.device.getDeviceId();
186
186
  const deviceInfo = await this.device.getDeviceInfo();
187
+ console.log("this.api.apiKey", this.api.apiKey);
188
+ console.log("this.api.orgId", this.api.orgId);
189
+ console.log("this.api.projectId", this.api.projectId);
190
+ console.log("this.api.environmentSlug", this.api.environmentSlug);
191
+ console.log("this.api.deviceId", deviceId);
187
192
  const response = await this.api.client("/v1/identify", {
188
193
  method: "POST",
189
194
  headers: {
@@ -208,6 +213,7 @@ export class IdentityClient {
208
213
  });
209
214
 
210
215
  if (response.error != null) {
216
+ console.log("identify error", response.error.status, response.error.value);
211
217
  this.setIdentifyState(previousState);
212
218
 
213
219
  if (response.error.status === 422) {