Jesus gave thanks when faced with impossible, lack, tragedy, oncoming suffering (Luke 22:19; John 6:11; John 11:41) which preceded three great miracles (5 loaves 2 fish, Lazarus, His resurrection after death)
Giving thanks to God is a declaration of faith that GOOD will come out of these passing hardships. It’s an expression of trust
in who He is and His unchanging GOOD character. He who loves me is in control and He has a GOOD purpose far greater than the temporary suffering I am going thru.
He is not finished yet; these will work out for my GOOD (Rom 8:28-29). The impossible circumstances that have no human solution are a platform for God’s glory. When they are resolved, it is clear that only God could have done it. “Give thanks in all circumstances; for this is God’s will for you in Christ Jesus.” 1 Thessalonians 5:18 NIV
Thankfulness will lead to restedness.