The spark on switch-off narrows the area of inquiry.
As a further test leave the bike switched on and flick the kill switch off and on.
If you still have a spark each time you operate the kill switch the good news is that your coil and the Ignition Control Unit ICU are alive and what you are lacking is a triggering pulse from the bean can.
Open, clean and close each connector to the beancan - we are dealing with very low current so surface corrosion invisible to theeye will stop proceedings.
Put it back together and see if it works.
No - you need a beancan.
Options.
My personal favorite - a complete Wedgetail system. This is the gold standard for airhead ignitions, the drawback is the price.
A refurbished beancan. I used to do these myself using the HKZ101 Hall Effect.I don't do this anymore as the last 5 beancans I have opened had significant wear in the mechanical advance/retard, you can't buy parts and my eyesight and patience are no longer up to fabricating new ones. Your mileage may vary.
The Australian tri-spark system seems to get mostly good reviews, i have never handled one but it ishard to disagree with happy cusomers.
Various crankshaft triggered systems.Never tried one, i have fixed one and was noot impressed. YMMV.
Revert to points using an early points beancan. This is not as silly as it sounds as there are a few points cans floating around that were removed from service and replaced by electronics years ago.
Boyer Bransden. I have 2 bikes with BB ignitions. One of them will be replaced by the Wedgetail I have waiting when I get around too it. Boyer are cheap-ish and they do work but I would refit points before fitting another.