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

WFCatDevelopSettingsTest.lua

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

ADOBE CONFIDENTIAL
___________________

Copyright 2019 Adobe

All Rights Reserved.

NOTICE: All information contained herein is, and remains
the property of Adobe and its suppliers, if any. The intellectual
and technical concepts contained herein are proprietary to Adobe
and its suppliers and are protected by all applicable intellectual
property laws, including trade secret and copyright laws.
Dissemination of this information or reproduction of this material
is strictly forbidden unless prior written permission is obtained
from Adobe.
------------------------------------------------------------------------------]]

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

    -- WF.oz_client.managed_catalog
local WFCatDevelopSettings = require 'WFCatDevelopSettings'


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

local WFCatDevelopSettingsTest = {}

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

function WFCatDevelopSettingsTest.rxTestWaitForPendingDevelopSettingsSaveForAssetIds( rxTest )

	local assetIds = {
		'a',
		'b',
		'c'
	}

	-- No Assets Pending
	
	local observer = 
			rxTest:observe( WFCatDevelopSettings.waitForPendingDevelopSettingsSaveForAssetIds( assetIds ) )

	observer:expectDataWithinTime( 1, true )
	observer:expectCompleted()
	
	-- 1 Pending Asset
	
	WFCatDevelopSettings._DEBUG_pendingDevelopSettingsSaveInProgress( 1, 'a' )
	
	observer = 
			rxTest:observe( WFCatDevelopSettings.waitForPendingDevelopSettingsSaveForAssetIds( assetIds ) )

	WFCatDevelopSettings._DEBUG_pendingDevelopSettingsSaveSucceeded( 1, 'a' )

	observer:expectDataWithinTime( 1, true )
	observer:expectCompleted()

	-- All Assets Pending
	
	WFCatDevelopSettings._DEBUG_pendingDevelopSettingsSaveInProgress( 1, 'a' )
	WFCatDevelopSettings._DEBUG_pendingDevelopSettingsSaveInProgress( 2, 'b' )
	WFCatDevelopSettings._DEBUG_pendingDevelopSettingsSaveInProgress( 3, 'c' )
	
	observer = 
			rxTest:observe( WFCatDevelopSettings.waitForPendingDevelopSettingsSaveForAssetIds( assetIds ) )

	WFCatDevelopSettings._DEBUG_pendingDevelopSettingsSaveSucceeded( 1, 'a' )
	WFCatDevelopSettings._DEBUG_pendingDevelopSettingsSaveSucceeded( 2, 'b' )
	WFCatDevelopSettings._DEBUG_pendingDevelopSettingsSaveSucceeded( 3, 'c' )

	observer:expectDataWithinTime( 1, true )
	observer:expectCompleted()
	
end


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

return WFRxTestCase.wrapSuite( WFCatDevelopSettingsTest )
