Baobab Fixes and Additional Specs

Hey @caitp —if you have a chance, I'd love for you to look over these commits. The first three are minor fixes we've made for Baobab and additional specs that cover those changes. The last one is a larger refactor that removes a lot of duplicate logic from the constructors of the individual classes and adds a dozen or so tests for the logic in the base class constructor. Since I haven't written many JS tests, it'd be great to get your feedback before I write more!

Sorry these are consolidated into a single PR — I suppose I should have filed an issue and PR for each one but things have been all over the place today.
can't redeclare `ii` here because it's already declared in this function --- usually the nextmost letter is a good pick (but it doesn't really matter so that it's distinct). Typically you'll see `j` used as the next after `i`, then followed by `k`. It's somewhat up to personal taste, but having patterns which are re-used is good so that you can kind of easily see when something is right or not.