From 1fbb666375a0bece2d82e954fcbfeebf555d60c7 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Mon, 19 Feb 2018 12:03:39 +0100 Subject: [PATCH] API responses changed for mock drug unit tests --- .../src/test/js/gui/leftPanel/DrugPanel-test.js | 17 +++++++++-------- .../query=NADH&token=MOCK_TOKEN_ID& | 2 +- .../query=aspirin&token=MOCK_TOKEN_ID& | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/frontend-js/src/test/js/gui/leftPanel/DrugPanel-test.js b/frontend-js/src/test/js/gui/leftPanel/DrugPanel-test.js index 713dd58053..4488f33903 100644 --- a/frontend-js/src/test/js/gui/leftPanel/DrugPanel-test.js +++ b/frontend-js/src/test/js/gui/leftPanel/DrugPanel-test.js @@ -60,16 +60,17 @@ describe('DrugPanel', function () { }); it('on searchResults changed', function () { - var map = helper.createCustomMap(); - map.getModel().setId(15781); - var drugDbOverlay = helper.createDrugDbOverlay(map); + return ServerConnector.getProject().then(function (project) { + var map = helper.createCustomMap(project); + var drugDbOverlay = helper.createDrugDbOverlay(map); - new DrugPanel({ - element: testDiv, - customMap: map - }); + new DrugPanel({ + element: testDiv, + customMap: map + }); - return drugDbOverlay.searchByQuery("aspirin").then(function () { + return drugDbOverlay.searchByQuery("aspirin"); + }).then(function () { assert.equal(logger.getWarnings().length, 0); assert.ok(testDiv.innerHTML.indexOf("Acetylsalicylic acid") >= 0); }); diff --git a/frontend-js/testFiles/apiCalls/projects/sample/drugs.search/query=NADH&token=MOCK_TOKEN_ID& b/frontend-js/testFiles/apiCalls/projects/sample/drugs.search/query=NADH&token=MOCK_TOKEN_ID& index 358201fdef..106995c7e4 100644 --- a/frontend-js/testFiles/apiCalls/projects/sample/drugs.search/query=NADH&token=MOCK_TOKEN_ID& +++ b/frontend-js/testFiles/apiCalls/projects/sample/drugs.search/query=NADH&token=MOCK_TOKEN_ID& @@ -1 +1 @@ -[{"brandNames":[],"references":[{"resource":"DB00157","link":"http://www.drugbank.ca/drugs/DB00157","id":0,"type":"DRUGBANK"}],"synonyms":["1,4-dihydronicotinamide adenine dinucleotide","DPNH","NAD reduced form","Nicotinamide adenine dinucleotide (reduced)","Nicotinamide-adenine dinucleotide, reduced","Reduced nicotinamide adenine diphosphate","Reduced nicotinamide-adenine dinucleotide"],"name":"NADH","description":"NADH is the reduced form of NAD+, and NAD+ is the oxidized form of NADH, a coenzyme composed of ribosylnicotinamide 5'-diphosphate coupled to adenosine 5'-phosphate by pyrophosphate linkage. It is found widely in nature and is involved in numerous enzymatic reactions in which it serves as an electron carrier by being alternately oxidized (NAD+) and reduced (NADH). It forms NADP with the addition of a phosphate group to the 2' position of the adenosyl nucleotide through an ester linkage. (Dorland, 27th ed)","id":"NADH","targets":[],"bloodBrainBarrier":"YES"}] \ No newline at end of file +[{"brandNames":[],"references":[{"resource":"DB00157","annotatorClassName":"","descriptionByTypeRelation":"","descriptionByType":"","link":"http://www.drugbank.ca/drugs/DB00157","id":0,"type":"DRUGBANK"}],"synonyms":[],"name":"NADH","description":"NADH is the reduced form of NAD+, and NAD+ is the oxidized form of NADH, a coenzyme composed of ribosylnicotinamide 5'-diphosphate coupled to adenosine 5'-phosphate by pyrophosphate linkage. It is found widely in nature and is involved in numerous enzymatic reactions in which it serves as an electron carrier by being alternately oxidized (NAD+) and reduced (NADH). It forms NADP with the addition of a phosphate group to the 2' position of the adenosyl nucleotide through an ester linkage. (Dorland, 27th ed) ","id":"NADH","targets":[],"bloodBrainBarrier":"YES"}] \ No newline at end of file diff --git a/frontend-js/testFiles/apiCalls/projects/sample/drugs.search/query=aspirin&token=MOCK_TOKEN_ID& b/frontend-js/testFiles/apiCalls/projects/sample/drugs.search/query=aspirin&token=MOCK_TOKEN_ID& index 6aac976db2..53269de03a 100644 --- a/frontend-js/testFiles/apiCalls/projects/sample/drugs.search/query=aspirin&token=MOCK_TOKEN_ID& +++ b/frontend-js/testFiles/apiCalls/projects/sample/drugs.search/query=aspirin&token=MOCK_TOKEN_ID& @@ -1 +1 @@ -[{"brandNames":["Acenterine","Acetophen","Adiro","Aspergum","Aspro","Bayer Aspirin","Easprin","Empirin","Nu-seals","Rhodine","Rhonal","Solprin","Solprin acid","St. Joseph Aspirin for Adults","Tasprin"],"references":[{"resource":"DB00945","link":"http://www.drugbank.ca/drugs/DB00945","id":0,"type":"DRUGBANK"},{"resource":"CHEMBL25","link":"https://www.ebi.ac.uk/chembl/compound/inspect/CHEMBL25","id":0,"type":"CHEMBL_COMPOUND"}],"synonyms":["2-Acetoxybenzenecarboxylic acid","2-Acetoxybenzoic acid","Acetylsalicylate","Acetylsalicylsäure","acide 2-(acÊtyloxy)benzoïque","acide acÊtylsalicylique","Ã¥cido acetilsalicÃÂÂlico","Acidum acetylsalicylicum","ASA","Aspirin","Azetylsalizylsäure","o-acetoxybenzoic acid","O-acetylsalicylic acid","o-carboxyphenyl acetate","Polopiryna","salicylic acid acetate","8-hour bayer","ACETYLSALICYLIC ACID","ASPIRIN","Acetosalic Acid","Acetylsalicylic Acid","Bayer extra strength aspirin for migraine pain","Ecotrin","Equi-Prin","Measurin","Salicylic Acid Acetate"],"name":"ASPIRIN","description":"The prototypical analgesic used in the treatment of mild to moderate pain. It has anti-inflammatory and antipyretic properties and acts as an inhibitor of cyclooxygenase which results in the inhibition of the biosynthesis of prostaglandins. Acetylsalicylic acid also inhibits platelet aggregation and is used in the prevention of arterial and venous thrombosis. (From Martindale, The Extra Pharmacopoeia, 30th ed, p5) ","id":"ASPIRIN","targets":[],"bloodBrainBarrier":"YES"}] \ No newline at end of file +[{"brandNames":["Acenterine","Acetophen","Adiro","Aspergum","Aspro","Bayer Aspirin","Easprin","Empirin","Nu-seals","Rhodine","Rhonal","Solprin","Solprin acid","St. Joseph Aspirin for Adults","Tasprin"],"references":[{"resource":"DB00945","annotatorClassName":"","descriptionByTypeRelation":"","descriptionByType":"","link":"http://www.drugbank.ca/drugs/DB00945","id":0,"type":"DRUGBANK"},{"resource":"CHEMBL25","annotatorClassName":"","descriptionByTypeRelation":"","descriptionByType":"","link":"https://www.ebi.ac.uk/chembl/compound/inspect/CHEMBL25","id":0,"type":"CHEMBL_COMPOUND"}],"synonyms":["2-Acetoxybenzenecarboxylic acid","2-Acetoxybenzoic acid","Acetylsalicylate","Acetylsalicylsäure","acide 2-(acétyloxy)benzoïque","acide acétylsalicylique","ácido acetilsalicÃlico","Acidum acetylsalicylicum","ASA","Aspirin","Azetylsalizylsäure","o-acetoxybenzoic acid","O-acetylsalicylic acid","o-carboxyphenyl acetate","Polopiryna","salicylic acid acetate","8-hour bayer","ACETYLSALICYLIC ACID","ASPIRIN","Acetosalic Acid","Acetylsalicylic Acid","Bayer extra strength aspirin for migraine pain","Ecotrin","Equi-Prin","Measurin","Salicylic Acid Acetate"],"name":"ASPIRIN","description":"The prototypical analgesic used in the treatment of mild to moderate pain. It has anti-inflammatory and antipyretic properties and acts as an inhibitor of cyclooxygenase which results in the inhibition of the biosynthesis of prostaglandins. Acetylsalicylic acid also inhibits platelet aggregation and is used in the prevention of arterial and venous thrombosis. (From Martindale, The Extra Pharmacopoeia, 30th ed, p5) ","id":"ASPIRIN","targets":[],"bloodBrainBarrier":"YES"}] \ No newline at end of file -- GitLab