/*
 * Copyright 2025 - 2026 PICO. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.pico.spatialui.sample.viewmodel

import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test

class FeedsViewModelTest {

    @Test
    fun bannerCardList_isPopulatedWithUniqueIds() {
        val vm = FeedsViewModel()
        val list = vm.bannerCardList.value
        assertEquals(9, list.size)
        assertEquals(list.size, list.map { it.id }.toSet().size)
        assertTrue(list.all { it.id.startsWith("banner-") })
    }

    @Test
    fun fixedGridCardList_hasFourItemsWithIds() {
        val vm = FeedsViewModel()
        val list = vm.fixedGridCardList.value
        assertEquals(4, list.size)
        assertTrue(list.all { it.id.startsWith("fixed-") })
    }

    @Test
    fun userList_hasThreeUsersAndHotFlagCorrect() {
        val vm = FeedsViewModel()
        val users = vm.userList.value
        assertEquals(3, users.size)
        assertTrue(users.any { it.id == "user_1" && it.hot })
    }

    @Test
    fun cardList_hasExpectedSizeAndDistinctIds() {
        val vm = FeedsViewModel()
        val list = vm.cardList.value
        assertEquals(12, list.size)
        assertEquals(list.size, list.map { it.id }.toSet().size)
        assertTrue(list.all { it.id.startsWith("id_") })
    }
}
