Is there any demo or document for test motoko code?

I have studied Motoko in the past few days, and I like it very much, especially when it is used to calculate the factorial of 5000. It is fast and very accurate, which is comparable to the one implemented with Rust. And its code is more concise. Considering that it is running in the wasm virtual machine, it is even more incredible!

As the title, I want to write a test module to test some logic implemented by motoko, to verify that the code is functioning in the expected manner.

Are there any document about this?

1 Like

You could take a look at @kritzcreek ’s Motoko matchers, here: GitHub - kritzcreek/motoko-matchers


Also @kritzcreek has published a repository template for Motoko libraries that includes a simple test setup (including CI!):