Recent observations have been discovering new ultra-faint dwarf galaxies as small as $sim20~{rm pc}$ in half-light radius and $sim3~{rm km~s^{-1}}$ in line-of-sight velocity dispersion. In these galaxies, dynamical friction on a star against dark matter can be significant and alter their stellar density distribution. The effect can strongly depend on a central density profile of dark matter, i.e. cusp or core. In this study, I perform computations using a classical and a modern analytic formulae and $N$-body simulations to study how dynamical friction changes a stellar density profile and how different it is between cuspy and cored dark matter haloes. This study shows that, if a dark matter halo has a cusp, dynamical friction can cause shrivelling instability which results in emergence of a stellar cusp in the central region $simeq2~{rm pc}$. On the other hand, if it has a constant-density core, dynamical friction is significantly weaker and does not generate a stellar cusp even if the galaxy has the same line-of-sight velocity dispersion. In such a compact and low-mass galaxy, since the shrivelling instability by dynamical friction is inevitable if it has a dark matter cusp, absence of a stellar cusp implies that the galaxy has a dark-matter core. I expect that this could be used to diagnose a dark matter density profile in these compact ultra-faint dwarf galaxies.