Fix selectUniquelyAssociatedWithCorpus and add another test

This commit fixes a bug in `selectUniquelyAssociatedWithCorpus` and adds
a test that ensures that if we have other corpora referencing a document
we are not going to delete it.
4 jobs for adinapoli/issue-458 in 43 minutes and 18 seconds (queued for 1 second)
latest
Status Job ID Name Coverage
  Cabal
passed #19336
cabal

00:21:06

 
  Stack
passed #19337
stack

00:02:43

 
  Bench
manual #19338
allowed to fail manual
bench
 
  Test
failed #19339
test

00:19:29

 
Name Stage Failure
failed
test Test
/builds/gargantext/haskell-gargantext/dist-newstyle/build/x86_64-linux/ghc-9.6.6/gargantext-0.0.7.5/t/garg-test/opt/test/gargantext-0.0.7.5-garg-test.log
0 of 1 test suites (0 of 1 test cases) passed.
Error: [Cabal-7125]
Tests failed for gargantext-0.0.7.5-inplace-garg-test.
CallStack (from HasCallStack):
dieWithException, called at src/Distribution/Client/ProjectOrchestration.hs:1232:21 in cabal-install-3.12.1.0-4VzemddeTcy9Sd7ImiySSq:Distribution.Client.ProjectOrchestration

Cleaning up project directory and file based variables
ERROR: Job failed: exit code 1