var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _globals=require("@jest/globals");var _react=_interopRequireDefault(require("react"));var _reactNative=require("@testing-library/react-native");var _hooks=require("../hooks");var _contexts=require("../contexts");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/runner/work/stytch-mobile/stytch-mobile/source/react-native/consumer/src/__tests__/hooks.test.tsx";_globals.jest.mock('../../lib/consumer-headless.mjs',function(){return{ConsumerAuthenticationState:{Loading:(0,_createClass2.default)(function Loading(){(0,_classCallCheck2.default)(this,Loading);})}};});(0,_globals.describe)('useStytch',function(){(0,_globals.it)('throws when called outside a StytchProvider',function(){(0,_globals.expect)(function(){return(0,_reactNative.renderHook)(function(){return(0,_hooks.useStytch)();});}).toThrow('useStytch() must be called within a <StytchProvider>.');});(0,_globals.it)('returns the client when inside a StytchProvider',function(){var mockClient={otp:{}};var wrapper=function wrapper(_ref){var children=_ref.children;return(0,_jsxRuntime.jsx)(_contexts.StytchContext.Provider,{value:mockClient,children:children});};var _renderHook=(0,_reactNative.renderHook)(function(){return(0,_hooks.useStytch)();},{wrapper:wrapper}),result=_renderHook.result;(0,_globals.expect)(result.current).toBe(mockClient);});});(0,_globals.describe)('useStytchUser',function(){(0,_globals.it)('returns undefined when no user is provided',function(){var _renderHook2=(0,_reactNative.renderHook)(function(){return(0,_hooks.useStytchUser)();}),result=_renderHook2.result;(0,_globals.expect)(result.current).toBeUndefined();});(0,_globals.it)('returns the user when provided',function(){var mockUser={userId:'user-123'};var wrapper=function wrapper(_ref2){var children=_ref2.children;return(0,_jsxRuntime.jsx)(_contexts.StytchUserContext.Provider,{value:mockUser,children:children});};var _renderHook3=(0,_reactNative.renderHook)(function(){return(0,_hooks.useStytchUser)();},{wrapper:wrapper}),result=_renderHook3.result;(0,_globals.expect)(result.current).toBe(mockUser);});});(0,_globals.describe)('useStytchSession',function(){(0,_globals.it)('returns undefined when no session is provided',function(){var _renderHook4=(0,_reactNative.renderHook)(function(){return(0,_hooks.useStytchSession)();}),result=_renderHook4.result;(0,_globals.expect)(result.current).toBeUndefined();});(0,_globals.it)('returns the session when provided',function(){var mockSession={sessionId:'session-123'};var wrapper=function wrapper(_ref3){var children=_ref3.children;return(0,_jsxRuntime.jsx)(_contexts.StytchSessionContext.Provider,{value:mockSession,children:children});};var _renderHook5=(0,_reactNative.renderHook)(function(){return(0,_hooks.useStytchSession)();},{wrapper:wrapper}),result=_renderHook5.result;(0,_globals.expect)(result.current).toBe(mockSession);});});(0,_globals.describe)('useStytchAuthenticationState',function(){(0,_globals.it)('returns the provided authentication state',function(){var mockState={type:'Loading'};var wrapper=function wrapper(_ref4){var children=_ref4.children;return(0,_jsxRuntime.jsx)(_contexts.StytchAuthenticationStateContext.Provider,{value:mockState,children:children});};var _renderHook6=(0,_reactNative.renderHook)(function(){return(0,_hooks.useStytchAuthenticationState)();},{wrapper:wrapper}),result=_renderHook6.result;(0,_globals.expect)(result.current).toBe(mockState);});});