I moved from gmail to fastmail a few years ago
and being the cynical sort of person that I am, I didn't trust the fastmail importer
so I ran it, and also wrote my own implementation using the gmail api (NOT imap), and another using the fastmail jmap api, and reconciled them
100% match (bar the "Muted" folder, which fastmail ignored)
pretty much perfect