Add tests and spec

Thanks to @polymetis for this