diff --git a/lib/api/Configuration.ts b/lib/api/Configuration.ts index efb3378..a6a74c2 100644 --- a/lib/api/Configuration.ts +++ b/lib/api/Configuration.ts @@ -178,7 +178,9 @@ export class Configuration { // Load exceptions - this.exceptions = this._getConfigurationFromPanel($, 'Exceptions').map((value) => new RegExp(value.regularexpression)) + this.exceptions = this._getConfigurationFromPanel($, 'Exceptions') + .filter((value) => value.regularexpression !== '') + .map((value) => new RegExp(value.regularexpression)) this.notificationSubjectTemplate = $( 'ac\\:parameter:contains("Notification Template") + ac\\:rich-text-body ac\\:parameter:contains("Subject") + ac\\:rich-text-body' diff --git a/test/ConfigurationTest.ts b/test/ConfigurationTest.ts index bdbe0ae..3b9b1de 100644 --- a/test/ConfigurationTest.ts +++ b/test/ConfigurationTest.ts @@ -28,4 +28,13 @@ describe('The Configuration API', (): void => { chai.expect(configuration.notificationFrom).to.eq('Notification ') }) + it('supports empty exclusion lines', async (): Promise => { + const mockServer = new MockServer('https://example.com') + mockServer.addConfigurationDocumentEndpoint() + + const configuration = new Configuration('https://example.com', 'nobody', 'nothing', '12346') + await configuration.load() + + chai.expect(configuration.exceptions).to.have.lengthOf(0) + }) }) diff --git a/test/MockServer.ts b/test/MockServer.ts index 574b885..810637c 100644 --- a/test/MockServer.ts +++ b/test/MockServer.ts @@ -142,6 +142,143 @@ export class MockServer { + + Notification Template + + + Subject +

${MockServer.NOTIFICATION_SUBJECT}

+
+ + Body + ${MockServer.NOTIFICATION_BODY} + +
+
+ `, + }, + }, + }) + this._scope + .get('/rest/api/content/12346?expand=body.storage') + .basicAuth({ + user: 'nobody', + pass: 'nothing', + }) + .reply(200, { + body: { + storage: { + value: ` + + Configuration + + + + + + + + + + + + + + + + + + + + +
SpaceSAMPLE
Domainexample.com
NotificationFromNotification <noreply@example.com>
+
+
+ + SMTP + + + + + + + + + + + + + + + + +
Hostlocalhost
Port25
+
+
+ + Checks + + + + + + + + + + + + + + + + + + + + +
LabelsMaxAge
test1356
test21234
+
+
+ + Maintainer + + + + + + + + + + + + + + + + +
PagepatternMaintainer
main/Test/.*maintainer,_lastauthor
+
+
+ + Exceptions + + + + + + + + + + + + + +
RegularExpression
+
+
Notification Template