Testing an atom.confirm dialog


#1

I just published my first package, and I was trying to write specs to cover the functionality.
I am using the atom.confirm feature but I am not sure if that is possible to test.

Does anyone know how to write a test to click a button on a confirm dialog?


#2

Generally, I wouldn’t bother. Because when you’re trying to click the button on the confirm dialog, you’re testing the dialog … which isn’t your code. I would use a Jasmine Spy to mock out the confirmation dialog and ensure that my code is calling it correctly, then make the spy return what I wanted to continue the test.

You can see an example in my bug-report package here:


#3

Ah nice, thanks! I’ll update my specs now.