This will help you kick start with Jasmin test cases.
I am trying to write a test for the sqleditor that checks that if _render() function (in sqleditor.js) is called with w query results that include primary keys, then the grid should be editable (I need to check grid options, gridView.grid.getOptions() ).
I also want to check that if the user edits a cell in the grid, the Save Data button (new button) is enabled. Is this feasible ?
This is similar to what is done in - web/regression/javascript/sqleditor/execute_query_spec.js for btn-flash.
Can anyone help me? I am new to front-end tests. In the sqleditor test I have seen, a spy is created for the SqlEditor to see if specific functions are called, but I want the actual _render() function to run (to call render_grid() of the gridView). In other words, I need to test the code inside_render() function.
Currently, _render is not directly testable using jasmine test cases. You need to break down the code to make it more testable. You can read through articleslike - https://hackernoon.com/how-to-refactor-unwieldy-untestable-code-4a73d75cb80a to get an idea. An example in pgAdmin would be web/pgadmin/static/js/sqleditor/execute_query.js