From 3fe297b8f137fb31ea41d4b5a3edf7552c5e287f Mon Sep 17 00:00:00 2001 From: Bauke Date: Tue, 18 Oct 2022 22:52:23 +0200 Subject: [PATCH] Add tests for Redirect getters & setters. --- tests/redirect.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/redirect.test.ts b/tests/redirect.test.ts index d2edb9d..ac64f9b 100644 --- a/tests/redirect.test.ts +++ b/tests/redirect.test.ts @@ -104,3 +104,17 @@ test('Narrow match & redirect types', (t) => { t.true(matcherTypes.every((value) => narrowMatchType(value))); t.true(redirectTypes.every((value) => narrowRedirectType(value))); }); + +test('Redirect getters & setters', (t) => { + const samples: Array<[Redirects, string]> = [ + [new HostnameRedirect(hostnameParameters), hostnameParameters.hostname], + [new SimpleRedirect(simpleParameters), simpleParameters.target], + ]; + + for (const [redirect, value] of samples) { + t.is(redirect.redirectValue, value); + const newValue = `${value} test`; + redirect.redirectValue = newValue; + t.is(redirect.redirectValue, newValue); + } +});