"agg_repertoires counts single-chain receptors correctly"
"Sample1 should have 2 unique receptors"
"Sample2 should have 2 unique receptors"
"Shared receptor should have count of 2"
"agg_repertoires identifies double-counting in paired-chain data"
"agg_repertoires handles paired-chain data with shared receptors"
"agg_repertoires proportions are affected by double-counting"
"agg_repertoires n_repertoires calculation is correct for paired data"
"Shared receptor should appear in 2 repertoires"
"Unique receptor should appear in 1 repertoire"
"agg_repertoires preserves second chain data (no NAs)"
"Annotation table should retain rows for both chains (IGH and IGL)"
"Should find exactly one row for the IGL chain"
"IGL row should have valid v_call data (not NA)"
"Both chains of the same receptor should share the same count stats"
"Both chains should belong to the same repertoire ID"

agg_repertoires counts single-chain receptors correctly

Expected `all(reps_na_counts == 0)` to be TRUE.
Differences:
`actual`:   FALSE
`expected`: TRUE 

context: single-chain duplicated receptors
annotation shape: 5x16
repertoire shape: 2x4
missing annotation columns: <none>
missing repertoire columns: <none>
annotation NA counts: imd_receptor_id=0, imd_repertoire_id=5, imd_count=5, imd_proportion=5, n_repertoires=0
repertoire NA counts: imd_repertoire_id=0, n_barcodes=0, n_receptors=2
unmatched repertoire ids: NA

annotations dump:
# A tibble: 5 x 16
  cell_id sample_id v_call j_call junction_aa locus umi_count filename          
* <chr>   <chr>     <chr>  <chr>  <chr>       <chr>     <dbl> <chr>             
1 cell1   Sample1   IGHV1  IGHJ1  CARW        IGH         100 "D:\\temp\\2026_0~
2 cell2   Sample1   IGHV1  IGHJ1  CARW        IGH         150 "D:\\temp\\2026_0~
3 cell3   Sample1   IGHV2  IGHJ2  CBRW        IGH         200 "D:\\temp\\2026_0~
4 cell4   Sample2   IGHV3  IGHJ3  CCRW        IGH         250 "D:\\temp\\2026_0~
5 cell5   Sample2   IGHV4  IGHJ4  CDRW        IGH         300 "D:\\temp\\2026_0~
# i 8 more variables: imd_barcode <chr>, imd_chain_id <int>,
#   imd_receptor_id <int>, imd_n_chains <dbl>, imd_count <dbl>,
#   imd_repertoire_id <int>, imd_proportion <dbl>, n_repertoires <int>

repertoires dump:
# A tibble: 2 x 4
  imd_repertoire_id sample_id n_barcodes n_receptors
              <int> <chr>          <dbl>       <int>
1                 1 Sample2            2          NA
2                 2 Sample1            3          NA