Working Effectively with Unit Tests by Jay Fields[1] is a great book on the subject. There's tons of books out there that are also good, but this is one I like to recommend as a starting point.
Another thing I'll do a lot of times when I'm trying to figure out how to test a weird situation is try to think of another API that works similarly and look to see if it has any tests that are instructive. And I habitually go through OSS projects I use to look at their tests and see what techniques I might not know about. This is really useful when you're picking up a new language or paradigm (e.g. when I started using functional languages over the OO languages I was used to.)
The basic thing you need to remember about testing is the AAA approach[2]: Arrange (setup); Act(do the thing you're testing); Assert (measure the outcome to make sure it is what you were expecting). Just about everything you read on testing at a lower level is going to come down to that procedure. There's additional techniques like fuzz testing and property testing, but they're not common. At a junior level I'd just expect you to have a basic understanding of AAA and how to apply it to common situations with the toolkit of your choice (e.g. for a javascript dev, maybe jest).
When you think about it, you already test your software, as you write it—its just that instead of writing down the steps in a way that your test framework can use, you're doing it manually. So really you just need to learn how to write down what you're doing in the browser (or whatever your interface is). Further refinement of that process is to use break your software up into pieces that can be more easily tested on their own.
I really just meant to post the first link, but testing is one of those areas that's near and dear to my heart, so my apologies for the rambling :)
[1] https://www.amazon.com/Working-Effectively-Unit-Tests-Fields...
[2] http://wiki.c2.com/?ArrangeActAssert