Add tests for cache invalidation with ref config and full config

This was testing for a possible bug which turned out not to exist,
but keeping the tests to be sure we never break it.