--[[----------------------------------------------------------------------------

WFReachabilityTest.lua

--------------------------------------------------------------------------------

ADOBE CONFIDENTIAL
------------------
Copyright 2012 Adobe Systems Incorporated
All Rights Reserved.

NOTICE: All information contained herein is, and remain the property of
Adobe Systems Incorporated and its suppliers, if any. The intellectual and
technical concepts contained herein are proprietary to Adobe Systems
Incorporated and its suppliers and may be covered by U.S. and Foreign
Patents, patents in process, and are protected by trade secret or copyright
law.  Dissemination of this information or reproduction of this material is
strictly forbidden unless prior written permission is obtained from
Adobe Systems Incorporated.

------------------------------------------------------------------------------]]

	-- WF.core.self_test
local WFAsyncTestCase = require 'WFAsyncTestCase'
local WFRxTestCase = require 'WFRxTestCase'

local WFReachability = require "WFReachability"
local WFPlatformInfo = require 'WFPlatformInfo'

--============================================================================--

local WFReachabilityTest = {}

--------------------------------------------------------------------------------

function WFReachabilityTest.rxTestRxBasicReachability( rxTest )

	rxTest:setTimeLimit( 10 )

	local ozHostIsReachable = WFReachability.hostIsReachable( 'https://photos-stage.adobe.io' ) 

	rxTest:observe(
		
		ozHostIsReachable
			:map( function( reachable )
				return reachable ~= 'unreachable'
			end ) )
		
		:expectDataWithinTime( 10, true )
	
end

--------------------------------------------------------------------------------

function WFReachabilityTest.testBasicReachability( test )

	local ozHostIsReachableB = WFReachability.hostIsReachableB( 'https://photos-stage.adobe.io' )
	
	WFAsyncTestCase( test, 10 )

		:waitFor( function()
			return ozHostIsReachableB
				:mapB( function( reachable )
					return reachable ~= 'unreachable'
				end )
		end )
		:continueWhenValueMatches( true )
	
end

--------------------------------------------------------------------------------

return WFRxTestCase.wrapSuite( 'WFReachabilityTest', WFReachabilityTest )
