From 257ea3f36b764b20a79c356c8e4ac7cfe5240015 Mon Sep 17 00:00:00 2001 From: Spyros Date: Mon, 2 Oct 2023 17:27:46 +0100 Subject: [PATCH] Smartlink fix (#410) * fix smartlink functionality in case we don't know about a standard * lint and tests fix * lint2 * add e2e --- Makefile | 1 + application/frontend/src/test/basic-e2etest.ts | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/Makefile b/Makefile index 0d819b766..1717d2132 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,7 @@ e2e: yarn test:e2e killall yarn killall flask + test: [ -d "./venv" ] && . ./venv/bin/activate export FLASK_APP=$(CURDIR)/cre.py diff --git a/application/frontend/src/test/basic-e2etest.ts b/application/frontend/src/test/basic-e2etest.ts index 3d4c6a521..99e324cf1 100644 --- a/application/frontend/src/test/basic-e2etest.ts +++ b/application/frontend/src/test/basic-e2etest.ts @@ -166,5 +166,13 @@ describe('App.js', () => { ); expect(clearFilters).toContain('Clear Filters'); }); + + it('can smartlink', async () => { + const response = await page.goto('http://127.0.0.1:5000/smartlink/standard/CWE/1002'); + expect(response.url()).toBe('http://127.0.0.1:5000/node/standard/CWE/sectionid/1002'); + const redirectResponse = await page.goto('http://127.0.0.1:5000/smartlink/standard/CWE/404'); + expect(redirectResponse.url()).toBe('https://cwe.mitre.org/data/definitions/404.html'); + }); + afterAll(async () => await browser.close()); });