code: def test_indexed_on_status(tmp_dir, dvc, index):
      foo = tmp_dir.dvc_gen({"foo": "foo content"})[0].outs[0]
      bar = tmp_dir.dvc_gen({"bar": {"baz": "baz content"}})[0].outs[0]
      baz_hash = bar.obj._trie.get(("baz",))[1]
      dvc.push()
      index.clear()
  
      dvc.status(cloud=True)
      assert {bar.hash_info.value, baz_hash.value} == set(
          index.hashes()
      )
      assert [bar.hash_info.value] == list(index.dir_hashes())
      assert foo.hash_info.value not in index.hashes()
  
file_path: dvc/tests/func/data/db/test_index.py
imports: import os
  import pytest
  from dvc.exceptions import DownloadError, UploadError
  from dvc.utils.fs import remove
  from dvc_data.hashfile.db import get_index
label_desc: Use image node_id 2 for calling a global function with example usage: test_indexed_on_status(tmp_dir, dvc, index) without return types