Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hhwXt-0006Gf-CX for pgadmin-hackers@arkaria.postgresql.org; Mon, 01 Jul 2019 13:40:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hhwXs-0002yk-0e for pgadmin-hackers@arkaria.postgresql.org; Mon, 01 Jul 2019 13:40:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hhwXr-0002yd-NC for pgadmin-hackers@lists.postgresql.org; Mon, 01 Jul 2019 13:40:35 +0000 Received: from mail-qt1-x834.google.com ([2607:f8b0:4864:20::834]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hhwXo-0006ra-GU for pgadmin-hackers@postgresql.org; Mon, 01 Jul 2019 13:40:35 +0000 Received: by mail-qt1-x834.google.com with SMTP id h24so11620337qto.0 for ; Mon, 01 Jul 2019 06:40:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=fwwe+bGMef13kH3K1z2DniZ+m8A8wslrKOlmVDq7eiI=; b=nRoeQpEIf79HEd0QQM5/5ksy2/iNJHPiZJn16NgU40c1MXSjLhfZsoqCC8GUZUWMRT CiQcYi1jg/jNKiAxQbKzfqaBY7htA+/ZvUUeQEKBidzxGAR4i/5ZCBPBhbqhKJsgM1TK Ch4Sg8+/WVMTeSI28YMkzKK0nTLHdwkcswmAKRSz5HMq0gEE5WBLJWVzi0PpGnRopy31 2lx7ni/HdxbDOID0iAyn5kWx9t/ZXD9FFL4Vbi0mrpbMVzpqH724wmdq2dPY9NSg+yIS wojUiLyISVjvF/2p6F/6T/s1ksfp/2WSntv2GKuqhneCsonuRD1t1ycc2GRG5oMkq4pp wcYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=fwwe+bGMef13kH3K1z2DniZ+m8A8wslrKOlmVDq7eiI=; b=R4COWRIXWn8p1LsWTSiNQBrd2D9a5qHi79PCzOEnl41EbpVoyp1+CxJSO+BA4n0rE6 tFsmPuxowVPLPxrWZtaJZpHU2EOCvt9tS8EolBPDYMDIzLAkBWk+KAmMH1601vCW7WlR 1OGk3Nz4lNvbQToWsPWFE0xydbDZR8dwMK6fVz0xAb2ub+5BHE07g+UpKTxzp45+vCc9 QDX0BNQ7jxvqTnFcBy92O8TQs1QJRhyw7Uw8SdQIGsMn94SJY/sXEC1Yzqzm/U6Ueqaw VpEC8j5Qd9JSLZwKtzRyk4kmH58nFEeOzmx8bVt5+UER3uPP2+XCxJLDqv+MG5C9iK9I GHag== X-Gm-Message-State: APjAAAWtS+n626uE5MShJJ65St0TQ9mOGCBwWzSxPg6L0IWcQEpzXyYy 6AE/epd82dOg2sDZ/EoCYgYo+btmvML0eepCw1w= X-Google-Smtp-Source: APXvYqxrFqrxefoMceWjMtiu9tDzUWXML9gBftaIeqpa9kVKEaPv4IV0TMB9lKyzndkJy9Ld4OWn6HoK0vBP3DBJX9A= X-Received: by 2002:ac8:2b51:: with SMTP id 17mr20363445qtv.206.1561988430369; Mon, 01 Jul 2019 06:40:30 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Yosry Muhammad Date: Mon, 1 Jul 2019 15:40:19 +0200 Message-ID: Subject: Re: [GSoC] Help with Jasmine Tests To: Aditya Toshniwal , pgadmin-hackers@postgresql.org, Dave Page Content-Type: multipart/alternative; boundary="000000000000891a2e058c9ec504" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000891a2e058c9ec504 Content-Type: text/plain; charset="UTF-8" Thanks for your help, I will see what I can do. On Mon, Jul 1, 2019, 8:57 AM Aditya Toshniwal < aditya.toshniwal@enterprisedb.com> wrote: > Hi Yosry, > > On Sat, Jun 29, 2019 at 8:54 PM Yosry Muhammad wrote: > >> Hi all, >> >> I am writing tests for my initial patch of my Google Summer of Code >> project, which allows editing of SQL queries results (if they are >> updatable). >> > Please go through this page here - > https://jasmine.github.io/tutorials/your_first_suite > 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 > articles like - > 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 > >> >> Thanks a lot. >> >> -- >> *Yosry Muhammad Yosry* >> >> Computer Engineering student, >> The Faculty of Engineering, >> Cairo University (2021). >> Class representative of CMP 2021. >> https://www.linkedin.com/in/yosrym93/ >> > > > -- > Thanks and Regards, > Aditya Toshniwal > Software Engineer | EnterpriseDB India | Pune > "Don't Complain about Heat, Plant a TREE" > --000000000000891a2e058c9ec504 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks for your help, I will see what I can do.

=
On Mon, Ju= l 1, 2019, 8:57 AM Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:
Hi=C2=A0Yosry,=

On Sat, Jun 29, 2019 at 8:54 PM Yosry Muhammad <yosrym93@gmail.com= > wrote:
=
Hi all,

I am writing tests f= or my initial patch of my Google Summer of Code project, which allows editi= ng of SQL queries results (if they are updatable).
=
This will help you= kick start with Jasmin test cases.=C2=A0

I am tryi= ng 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 en= abled. Is this feasible ?
This is similar to what is done in - web/regression/j= avascript/sqleditor/execute_query_spec.js =C2=A0for 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 i= f specific functions are called, but I want the actual _render() function t= o run (to call render_grid() of the gridView). In other words, I need to te= st the code inside_render() function.
Currentl= y, _render is not directly testable using jasmine test cases. You need to b= reak down the code to make it more testable. You can read through articles<= /span>=C2=A0like -=C2=A0https://hackernoon.com/how-to-refactor-unwieldy-untestable-code-4a73d75c= b80a to get an idea.=C2= =A0An example in pgAdmin would be web/pgadmin/static/js/sqleditor/execute_query.js

Thanks a lot.

--
Yosry Muhammad Yosry<= /i>

Computer Engineering student,
The Faculty of Engineering,
Cairo University (2021).
Class repres= entative of CMP 2021.


--
Thanks and Regards,
Aditya Toshniwal
Software Engineer |=C2=A0EnterpriseDB India = |=C2=A0Pune
&qu= ot;Don't Complain about Heat, Plant a TREE"
--000000000000891a2e058c9ec504--