Bugs around that logic have bitten us a couple of times now, so it'd be good to have at least some basic tests.