From 3bcc56802d8be42f6f0efb91977a3c4493134011 Mon Sep 17 00:00:00 2001 From: Richard Waller Date: Thu, 23 Apr 2020 11:56:32 +0100 Subject: [PATCH] test: make test clearer Signed-off-by: Richard Waller --- test/src/API/templates/templates.test.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/test/src/API/templates/templates.test.js b/test/src/API/templates/templates.test.js index 98ecf2ea5..95b8c1ff6 100644 --- a/test/src/API/templates/templates.test.js +++ b/test/src/API/templates/templates.test.js @@ -113,17 +113,12 @@ describe('Template API tests', function() { }); describe('a duplicate url', function() { it('should return 400', async function() { - // Arrange - const res = await getTemplateRepos(); - const originalTemplateRepos = res.body; - const duplicateRepoUrl = originalTemplateRepos[0].url; - // Act - const duplicateUrlRes = await addTemplateRepo({ - url: duplicateRepoUrl, + const { body: [existingRepo] } = await getTemplateRepos(); + const res = await addTemplateRepo({ + url: existingRepo.url, description: 'duplicate url', }); - // Assert - duplicateUrlRes.should.have.status(400, duplicateUrlRes.text); + res.should.have.status(400, res.text); }); }); describe('a valid url that does not point to an index.json', function() {