This line is not needed, the mozMobileConnections mock already contains a fake connection by default so mozMobileConnections[0] is already correctly populated, you can remove this line entirely.