Component testing, persistent state and Pinia.

# Pinia, persistent state and cypress What up world! It's been some time since my last post so I wanted to take some time to write about what I have been working on over the past month and a half. Occupational demands have lead me to picking up cypress, a sick testing framework that is pretty easy to write and follows a straightforward declarative logic. For writing cypress component tests I found the following materials helpful:

Gives a great breakdown on how to write component tests https://www.youtube.com/watch?v=lfDjIGIAcKs&ab_channel=AlvaroDevLabs

Another helpful cypress talk on what to test https://www.youtube.com/watch?v=DD1fEhcEzY8&ab_channel=VueConfToronto

You can reference the docs here: https://docs.cypress.io/guides/component-testing/vue/overview

While i'm mostly working on component tests I do want to gradually move into writing end to end tests for my web apps in order to follow a test driven approach. I'm still trying to figure out the balance between pragmatic testing and going for complete coverage, since there seems to be some possibility of being slightly redundant between component, unit and e2e tests all looking at the same things (i may be wrong, please correct me if i am).

Outside of testing, I have been working on a personal project for a friend of mine who shapes surfboards. His company is called Current Craft and is based in Jupiter, Florida. By virtue of this project I have learned a lot more about state management and it's place in an ecommerce app. Current Craft uses Vue for a front end, Sanity as a CMS, and now Express to handle payments [express is in progress]. I used Pinia (i like it better than Vuex) to get an initial prototype of a cart working on the page. The idea is to add items defined by your sanity schemas as data that are stored by your state management library and then send those to your local storage. The reason for sending them to local storage is that I didn't want to rely on a plugin/library and add additional dependency to make the state persist. Every page reload checks local storage for cart items with a custom getter function i wrote. Then using computed properties we render the updated list of items. Pretty simple, the only thing I have to do next is work on the express / stripe integration next.