Sadly, the simple truth is: There is no test for sanity.
And even if there were, there is no telling at what point apparently perfectly sane people might suddenly 'snap'. We are humans and subject to the vagaries of life: relationship pressures and breakdowns, financial troubles, petty issues that can get magnified out of all proportion: the list is literally endless.
Perhaps, though, there is more room for an increased focus on what used to be termed in military and space quarters as 'the right stuff'.
Either way, the pressures for a short term 'fix' will be immense. It would not surprise me to see 1,500-hr minimums for First Officers, cockpit video cameras and further mandated changes to access procedures all coming in on the back of this.