UNPKG

@sentry/wizard

Version:

Sentry wizard helping you to configure your project

57 lines 2.56 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var expo_1 = require("../../src/react-native/expo"); describe('expo', function () { var MOCK_CONFIG = { url: 'https://sentry.mock/', org: 'sentry-mock', project: 'project-mock', authToken: 'authToken-mock', }; describe('addWithSentryToAppConfigJson', function () { test('do not add if sentry-expo present', function () { var appConfigJson = "{\n \"expo\": {\n \"plugins\": [\"sentry-expo\"]\n }\n }"; expect((0, expo_1.addWithSentryToAppConfigJson)(appConfigJson, MOCK_CONFIG)).toBeNull(); }); test('do not add if sentry-react-native/expo present', function () { var appConfigJson = "{\n \"expo\": {\n \"plugins\": [\"@sentry/react-native/expo\"]\n }\n }"; expect((0, expo_1.addWithSentryToAppConfigJson)(appConfigJson, MOCK_CONFIG)).toBeNull(); }); test.each([ [ "{\n \"expo\": {\n \"plugins\": \"should be an array, but it is not\"\n }\n }", ], [ "{\n \"expo\": [\"should be an object, but it is not\"]\n }", ], ])('do not add if plugins is not an array', function (appConfigJson) { expect((0, expo_1.addWithSentryToAppConfigJson)(appConfigJson, MOCK_CONFIG)).toBeNull(); }); test.each([ [ "{\n \"expo\": {\n \"plugins\": []\n }\n }", ], ["{}"], [ "{\n \"expo\": {}\n }", ], ])('add sentry react native expo plugin configuration', function (appConfigJson) { var result = (0, expo_1.addWithSentryToAppConfigJson)(appConfigJson, MOCK_CONFIG); expect(JSON.parse(result !== null && result !== void 0 ? result : '{}')).toStrictEqual({ expo: { plugins: [ [ '@sentry/react-native/expo', { url: 'https://sentry.mock/', organization: 'sentry-mock', project: 'project-mock', }, ], ], }, }); }); }); }); //# sourceMappingURL=expo.test.js.map