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 1hhqGC-00052E-3s for pgadmin-hackers@arkaria.postgresql.org; Mon, 01 Jul 2019 06:57:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hhqGA-0003Fn-K5 for pgadmin-hackers@arkaria.postgresql.org; Mon, 01 Jul 2019 06:57:54 +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 1hhqGA-0003Fg-A0 for pgadmin-hackers@lists.postgresql.org; Mon, 01 Jul 2019 06:57:54 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hhqG2-0002sN-M7 for pgadmin-hackers@postgresql.org; Mon, 01 Jul 2019 06:57:53 +0000 Received: by mail-lj1-x244.google.com with SMTP id v18so11895607ljh.6 for ; Sun, 30 Jun 2019 23:57:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nDprJaQ3sXV9Z1D8yyw6/YfjuDofu3c/xQWxuh4RwIA=; b=gZ7CKJBFGcuZ4DnIYH7RhrEJ6EAKhH5DdmidxESQOwfKdm8EOJr2TDDHQYXwTomPUU V4yYK5H770/BvFEfuSCfDkqct2b89R9pUULn/7/b48v2bKk/G1QLzakNQ+/YJiE0uy7t PxMZUE7c9ocEHLdcfe3t7m5meopWN6pKiRhHwAEzjctSDp+3zsjHNbeJKytMdEKvihEa wiCJiFLeBfu3psA4sZ+37u+ndhSN5LSGbaaBV66XYJSugO4CLsUt33VBMW8gEZcU3L9b rd/+/MUL/DjUlbm9EPfFHzaDNsV3jG7fpmJYon3vm9cHK5HFuMn3a+phc7xegaO4tXSF NH2Q== 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:cc; bh=nDprJaQ3sXV9Z1D8yyw6/YfjuDofu3c/xQWxuh4RwIA=; b=j1FeGH3/4d0THgj81GaPc7PCy/bacGpT8ZYGBY+Uip4nDfnKhDO9G3tSuloescWYnj nRfgXTvCnSnaE4llutsdRY5ehtaGCo+h+9myYMMsnYTWKqqMdOQxNXj8N4RrXHEflL95 b7B40uDwWzRzngG/cHnG6VdpbMyZiptGK/CUMW32+13JH+bo7weF0Nc+9aVsFqplDCw1 +A90zWDaRf4Dcdmg+OHO8/paXH9H7LJhOS8xlGiasFD4bm9Me4xxvgGO7ULjr7mcTve3 QyvPhK4MWKYOSzKcMIZfxXAsKWyfcQw6w5qA7bjwwfAOIFQMwMfQbrurHT03gEfk+v8j +DGA== X-Gm-Message-State: APjAAAWvXlP7rYHiX7CZWItygM9Enqnj+0Btu/7VJb6GFLcpYM1zK1XM Lkp4ObJaLubjLLNmSCbG/o+6Btes3Tn6bk3FCO+KzQ== X-Google-Smtp-Source: APXvYqy1VtVhLhIZbaWXA3gDtMbBCSYo2hSw5N3q6I2SyCazuMgc8aqOMW/n2Hn4Bjtkn5st13pQrJJKwvwSYf22+lo= X-Received: by 2002:a2e:5c09:: with SMTP id q9mr13210290ljb.120.1561964264850; Sun, 30 Jun 2019 23:57:44 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Aditya Toshniwal Date: Mon, 1 Jul 2019 12:27:09 +0530 Message-ID: Subject: Re: [GSoC] Help with Jasmine Tests To: Yosry Muhammad Cc: pgadmin-hackers , Dave Page Content-Type: multipart/alternative; boundary="000000000000289e5c058c9925f6" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000289e5c058c9925f6 Content-Type: text/plain; charset="UTF-8" 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" --000000000000289e5c058c9925f6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi=C2=A0Yosry,

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

I am writing t= ests for my initial patch of my Google Summer of Code project, which allows= editing of SQL queries results (if they are updatable).
This will help you kick start with Jasmin test ca= ses.=C2=A0

I am trying to write a test for the sqle= ditor that checks that if _render() function (in sqleditor.js) is called wi= th w query results that include primary keys, then the grid should be edita= ble (I need to check grid options, gridView.grid.getOptions() ).
=
I also want to check that if the user edits a cell in the g= rid, the Save Data button (new button) is enabled. Is this feasible ?
This is sim

Can anyo= ne 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() fun= ction.
Currently, _render is not directly test= able using jasmine test cases. You need to break down the code to make it m= ore testable. You can read through articles=C2=A0like -=C2=A0https://hackernoon.com/how-to-refactor-unwieldy-untestable-code-4= a73d75cb80a to get an idea.=C2=A0An example in pgAdmin = would be web/pgadmin/static/js/sqleditor/execute_query.js
<= /div>

Thanks a lot.

--
Yosry Muhammad Yosry

Computer Engineering student,
The F= aculty of Engineering,
Cairo University= (2021).
Class representative of CMP 20= 21.


--
Adi= tya Toshniwal
Software Engineer |=C2=A0EnterpriseDB India |=C2=A0Pune
"Don't Complain a= bout Heat, Plant a TREE"
--000000000000289e5c058c9925f6--