package com.example.libary

import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithText
import org.junit.Rule
import org.junit.Test

class CardPrimaryTest {

    @get:Rule
    val composeRule = createComposeRule()

    @Test
    fun test() {
        composeRule.setContent {
            PrimaryCard(
                name = "name",
                category = "category",
                price = "100",
                isAdd = false
            )
        }

        composeRule.onNodeWithText("name").assertIsDisplayed()
        composeRule.onNodeWithText("category").assertIsDisplayed()
        composeRule.onNodeWithText("100 ₽").assertIsDisplayed()
        composeRule.onNodeWithText("Убрать").assertIsDisplayed()
    }

    @Test
    fun test1() {
        composeRule.setContent {
            PrimaryCard(
                name = "name",
                category = "category",
                price = "100",
                isAdd = true
            )
        }

        composeRule.onNodeWithText("name").assertIsDisplayed()
        composeRule.onNodeWithText("category").assertIsDisplayed()
        composeRule.onNodeWithText("100 ₽").assertIsDisplayed()
        composeRule.onNodeWithText("Добавить").assertIsDisplayed()
    }
}