On 1/16/2019 9:53 AM, Guillaume Vincent wrote:
Hello Keycloak dev list,
in a previous post I raised the problem that the JavaScript adapter did not
have JavaScript tests.
In a couple of hours I created a simple example for Keycloak with unit and
functional tests
https://github.com/guillaumevincent/keycloak-lite
You can see tests in this file
https://github.com/guillaumevincent/keycloak-lite/blob/master/test.js
I also created a blog post on IMO How to test JavaScript code:
https://guillaumevincent.com/2019/01/15/test-in-javascript.html
Maybe we can open the discussion on how keycloak.js should be tested.
Without any fast and automated tests, in JavaScript, the refactor of the
keycloak adapter will not be easy at all.
wdyt?
Several thoughts:
* Basically, I agree. It makes sense to test javascript with
javascript. I like where you are going with this.
* An important point in any discussion of testing is that the only
useful test is a test that uncovers a bug. We never write tests
just to say we have lots of tests. Coverage is what matters. I'm
not criticizing your blog. It's just something I like to keep in mind.
* You mention TypeScript in your blog, but test.js appears to be
written in plain javascript. IMO, any javascript we write (with the
possible exception of keycloak.js) should be written in TypeScript.
Both internally and externally, developers are moving more and more
to TypeScript. Also, the Java developers on our team will be much
more comfortable and confident with a strongly typed language that
works well with an IDE.
* We need to know a little more about the current test coverage of the
javascript adapter. Much of it is tested through indirect means.
* We need to understand how javascript tests will integrate into our
builds.
* We need to standardize on a javascript test package. I don't want
the adapter to be tested with one library while the new account
management console is tested with another.