"Consider it pure joy, my brothers and sisters, whenever you face trials of many kinds, because you know that the testing of your faith produces perseverance. Let perseverance finish its work so that you may be mature and complete, not lacking anything."
When James writes that we should face trials with joy, he is talking about challenges to our faith that can help us learn and grow. He is talking about hardships we may face as believers in Christ, and how those can strengthen our faith and help us discern God's will.
For example, the first followers of Jesus were often persecuted. The apostles were filled with the Holy Spirit to preach the good news of Jesus and even to heal people in Jesus' name (Acts 2-3). And they were thrown in jail by the ruling authorities who did not believe in Jesus and his resurrection. The apostles were put on trial and asked where they got the authority to do such things. But they did not back down. Filled with the Spirit, they said, "There is no other name under heaven . . . by which we must be saved," and, "We must obey God rather than human beings!" And even though they were punished and brutally whipped for their faith and their actions, they had joy "because they had been counted worthy of disgrace for the Name" of Christ (see Acts 4-5).
Another example can be that we are always "prepared to give an answer . . . with gentleness and respect" to explain the hope that we have in Christ. "For it is better . . . to suffer for doing good than for doing evil" (1 Peter 3:15-17).
Lord, give us the courage we need to serve you and to face trials when they come, that we may grow mature in you. Amen.