diff --git a/app/lib/dal/indexDAL/leveldb/LevelDBSindex.ts b/app/lib/dal/indexDAL/leveldb/LevelDBSindex.ts
index c19ae888393aee7c232463a8db0ab19ac18e4444..bdb046713a987ed1377a0c3071e13be6c7a571f7 100644
--- a/app/lib/dal/indexDAL/leveldb/LevelDBSindex.ts
+++ b/app/lib/dal/indexDAL/leveldb/LevelDBSindex.ts
@@ -337,6 +337,13 @@ export class LevelDBSindex extends LevelDBTable<SindexEntry>
     }
   }
 
+  /**
+   * Allow to get internal index, for unit test (see test triming-dal.ts)
+   */
+  getInternalIndexes(): LevelDBTable<any>[] {
+    return [this.indexForTrimming, this.indexForConditions, this.indexForConditions, this.indexOfComplexeConditionForPubkeys];
+  }
+
   private async trimConditions(condition: string, id: string) {
     // Get all the condition's sources
     const existing = (await this.indexForConditions.getOrNull(condition)) || [];
diff --git a/test/dal/triming-dal.ts b/test/dal/triming-dal.ts
index be921161ce9f438fc8eb96af619773a3fe3a30ec..2de28ad0e658bd215e0780905d689fdabf3ad08f 100644
--- a/test/dal/triming-dal.ts
+++ b/test/dal/triming-dal.ts
@@ -15,6 +15,7 @@ import {FileDAL} from "../../app/lib/dal/fileDAL"
 import {Directory} from "../../app/lib/system/directory"
 import {Indexer} from "../../app/lib/indexer"
 import {simpleNodeWith2Users} from "../integration/tools/toolbox"
+import {LevelDBSindex} from "../../app/lib/dal/indexDAL/leveldb/LevelDBSindex";
 
 const should = require('should');
 
@@ -135,6 +136,19 @@ describe("Triming", function(){
     (await dal.sindexDAL.getAvailableForConditions('COND(SOURCE_1)')).should.have.length(0);
     (await dal.sindexDAL.getAvailableForPubkey('PUB_1')).should.have.length(1);
     (await dal.sindexDAL.findByPos(4)).should.have.length(2);
+
+    // Consumed all, then trim again. => All sub indices should be empty
+    await dal.sindexDAL.insertBatch([
+      { op: 'UPDATE', identifier: 'SOURCE_2', pos: 4, written_on: '140-H', writtenOn: 140, written_time: 5000, consumed: true, conditions: 'COND(SOURCE_2)'},
+      { op: 'UPDATE', identifier: 'SOURCE_3', pos: 4, written_on: '140-H', writtenOn: 140, written_time: 5000, consumed: true, conditions: 'SIG(PUB_1)'}
+    ] as any);
+    await dal.trimIndexes(141);
+    if (dal.sindexDAL instanceof LevelDBSindex) {
+      for (let index of dal.sindexDAL.getInternalIndexes()) {
+        const res = await index.findAllKeys();
+        res.should.have.length(0, `index ${index['name']} should have been trimmed`);
+      }
+    }
   })
 
   it('should be able to trim the bindex', async () => {