Either get hold of the original service A in your beforeEach and modify it or simply recreate it before your test runs. Something like this:
angular.module('MockAModule', []).factory('A', function() {
// Mock out A here
});
// This will load the BModule, and potential the original AModule if it is a dependency
beforeEach(module('BModule'));
// This will load the MockAModule, which will overwrite the original A service with your mock.
beforeEach(module('MockAModule'));
var B;
beforeEach(inject(B, function(_B_) {
B = _B_;
});
describe('B', function() {
// Test B