From 4419501f27c7881425bae3874e6b7b7029bbfb1c Mon Sep 17 00:00:00 2001 From: zvonimir-delas Date: Wed, 19 Nov 2025 11:39:31 +0000 Subject: [PATCH] Add simple Bruno tests --- .../Default turninator/Monolog simple.bru | 72 ++++++++++++++++ .../Default turninator/XAIF Dialog.bru | 82 +++++++++++++++++++ .../Default turninator/XAIF Minimal.bru | 68 +++++++++++++++ .../Default turninator/bruno.json | 9 ++ .../environments/(1) local.bru | 3 + .../environments/(2) staging.bru | 3 + .../environments/(3) production.bru | 3 + .../test-inputs/dialog_sample.txt | 4 + .../test-inputs/monolog_sample.txt | 1 + .../test-inputs/xaif_dialog.json | 13 +++ .../test-inputs/xaif_minimal.json | 13 +++ 11 files changed, 271 insertions(+) create mode 100644 tests/api-requests/Default turninator/Monolog simple.bru create mode 100644 tests/api-requests/Default turninator/XAIF Dialog.bru create mode 100644 tests/api-requests/Default turninator/XAIF Minimal.bru create mode 100644 tests/api-requests/Default turninator/bruno.json create mode 100644 tests/api-requests/Default turninator/environments/(1) local.bru create mode 100644 tests/api-requests/Default turninator/environments/(2) staging.bru create mode 100644 tests/api-requests/Default turninator/environments/(3) production.bru create mode 100644 tests/api-requests/Default turninator/test-inputs/dialog_sample.txt create mode 100644 tests/api-requests/Default turninator/test-inputs/monolog_sample.txt create mode 100644 tests/api-requests/Default turninator/test-inputs/xaif_dialog.json create mode 100644 tests/api-requests/Default turninator/test-inputs/xaif_minimal.json diff --git a/tests/api-requests/Default turninator/Monolog simple.bru b/tests/api-requests/Default turninator/Monolog simple.bru new file mode 100644 index 0000000..20c9721 --- /dev/null +++ b/tests/api-requests/Default turninator/Monolog simple.bru @@ -0,0 +1,72 @@ +meta { + name: Monolog simple + type: http + seq: 1 +} + +post { + url: {{baseUrl}}/turninator-01 + body: multipartForm + auth: inherit +} + +headers { + Content-Type: multipart/form-data +} + +body:multipart-form { + file: @file(test-inputs/monolog_sample.txt) +} + +tests { + const expectedData = + { + "AIF": { + "nodes": [ + { + "text": "This is a sample argument about climate change. We need to take action now to reduce carbon emissions. The scientific evidence is overwhelming and shows that human activities are the primary cause of global warming. Therefore, we must implement stricter environmental regulations.", + "type": "L", + "nodeID": 0 + } + ], + "edges": [], + "locutions": [ + { + "personID": 1, + "nodeID": 0 + } + ], + "schemefulfillments": [], + "descriptorfulfillments": [], + "participants": [ + { + "participantID": 1, + "firstname": "Default", + "surname": "Speaker" + } + ] + }, + "ova": {}, + "dialog": {}, + "text": { + "txt": " Default Speaker This is a sample argument about climate change. We need to take action now to reduce carbon emissions. The scientific evidence is overwhelming and shows that human activities are the primary cause of global warming. Therefore, we must implement stricter environmental regulations..

" + } + }; + + // And this is how long the request should take before deemed too slow: + const maxTimeToReturnInMilliseconds = 300; + + test("Response should match expected value", function () { + const receivedData = res.getBody(); + expect(receivedData).to.deep.equal(expectedData); + }); + + test(`Response time should be faster than ${maxTimeToReturnInMilliseconds} milliseconds`, function () { + expect(res.responseTime).to.be.below(maxTimeToReturnInMilliseconds); + }); +} + +settings { + encodeUrl: false + timeout: 0 +} diff --git a/tests/api-requests/Default turninator/XAIF Dialog.bru b/tests/api-requests/Default turninator/XAIF Dialog.bru new file mode 100644 index 0000000..9a9de3f --- /dev/null +++ b/tests/api-requests/Default turninator/XAIF Dialog.bru @@ -0,0 +1,82 @@ +meta { + name: XAIF Dialog + type: http + seq: 2 +} + +post { + url: {{baseUrl}}/turninator-01 + body: multipartForm + auth: inherit +} + +headers { + Content-Type: multipart/form-data +} + +body:multipart-form { + file: @file(test-inputs/xaif_dialog.json) +} + +tests { + const expectedData = + { + "AIF": { + "nodes": [ + { + "text": "We should invest in education.", + "type": "L", + "nodeID": 0 + }, + { + "text": "I think healthcare is more important.", + "type": "L", + "nodeID": 1 + } + ], + "edges": [], + "locutions": [ + { + "personID": 0, + "nodeID": 0 + }, + { + "personID": 1, + "nodeID": 1 + } + ], + "participants": [ + { + "participantID": 0, + "firstname": "Alice", + "surname": "None" + }, + { + "participantID": 1, + "firstname": "Bob", + "surname": "None" + } + ], + "schemefulfillments": [], + "descriptorfulfillments": [] + }, + "text": { + "txt": " Alice None We should invest in education..

Bob None I think healthcare is more important..

" + }, + "dialog": true, + "OVA": {}, + "ova": {} + }; + + // And this is how long the request should take before deemed too slow: + const maxTimeToReturnInMilliseconds = 300; + + test("Response should match expected value", function () { + const receivedData = res.getBody(); + expect(receivedData).to.deep.equal(expectedData); + }); + + test(`Response time should be faster than ${maxTimeToReturnInMilliseconds} milliseconds`, function () { + expect(res.responseTime).to.be.below(maxTimeToReturnInMilliseconds); + }); +} diff --git a/tests/api-requests/Default turninator/XAIF Minimal.bru b/tests/api-requests/Default turninator/XAIF Minimal.bru new file mode 100644 index 0000000..e6ac4ea --- /dev/null +++ b/tests/api-requests/Default turninator/XAIF Minimal.bru @@ -0,0 +1,68 @@ +meta { + name: XAIF Minimal + type: http + seq: 3 +} + +post { + url: {{baseUrl}}/turninator-01 + body: multipartForm + auth: inherit +} + +headers { + Content-Type: multipart/form-data +} + +body:multipart-form { + file: @file(test-inputs/xaif_minimal.json) +} + +tests { + const expectedData = + { + "AIF": { + "nodes": [ + { + "text": "This is a sample argument text that will be processed by the turninator.", + "type": "L", + "nodeID": 0 + } + ], + "edges": [], + "locutions": [ + { + "personID": 1, + "nodeID": 0 + } + ], + "participants": [ + { + "participantID": 1, + "firstname": "Default", + "surname": "Speaker" + } + ], + "schemefulfillments": [], + "descriptorfulfillments": [] + }, + "text": { + "txt": " Default Speaker This is a sample argument text that will be processed by the turninator..

" + }, + "dialog": false, + "OVA": {}, + "ova": {} + }; + + // And this is how long the request should take before deemed too slow: + const maxTimeToReturnInMilliseconds = 300; + + test("Response should match expected value", function () { + const receivedData = res.getBody(); + expect(receivedData).to.deep.equal(expectedData); + }); + + test(`Response time should be faster than ${maxTimeToReturnInMilliseconds} milliseconds`, function () { + expect(res.responseTime).to.be.below(maxTimeToReturnInMilliseconds); + }); +} diff --git a/tests/api-requests/Default turninator/bruno.json b/tests/api-requests/Default turninator/bruno.json new file mode 100644 index 0000000..8e22bba --- /dev/null +++ b/tests/api-requests/Default turninator/bruno.json @@ -0,0 +1,9 @@ +{ + "version": "1", + "name": "Default turninator", + "type": "collection", + "ignore": [ + "node_modules", + ".git" + ] +} \ No newline at end of file diff --git a/tests/api-requests/Default turninator/environments/(1) local.bru b/tests/api-requests/Default turninator/environments/(1) local.bru new file mode 100644 index 0000000..6fa323a --- /dev/null +++ b/tests/api-requests/Default turninator/environments/(1) local.bru @@ -0,0 +1,3 @@ +vars { + baseUrl: http://localhost:5006 +} diff --git a/tests/api-requests/Default turninator/environments/(2) staging.bru b/tests/api-requests/Default turninator/environments/(2) staging.bru new file mode 100644 index 0000000..051bf32 --- /dev/null +++ b/tests/api-requests/Default turninator/environments/(2) staging.bru @@ -0,0 +1,3 @@ +vars { + baseUrl: http://default-turninator.amfws.staging.arg.tech +} diff --git a/tests/api-requests/Default turninator/environments/(3) production.bru b/tests/api-requests/Default turninator/environments/(3) production.bru new file mode 100644 index 0000000..d5b1e18 --- /dev/null +++ b/tests/api-requests/Default turninator/environments/(3) production.bru @@ -0,0 +1,3 @@ +vars { + baseUrl: http://default-turninator.amfws.arg.tech +} diff --git a/tests/api-requests/Default turninator/test-inputs/dialog_sample.txt b/tests/api-requests/Default turninator/test-inputs/dialog_sample.txt new file mode 100644 index 0000000..a7b2e99 --- /dev/null +++ b/tests/api-requests/Default turninator/test-inputs/dialog_sample.txt @@ -0,0 +1,4 @@ +John Smith: I believe renewable energy is the future. +Jane Doe: I agree, but we need to consider the economic implications. +John Smith: The long-term benefits outweigh the initial costs. +Jane Doe: That's a fair point, but we also need to support workers in traditional energy sectors. \ No newline at end of file diff --git a/tests/api-requests/Default turninator/test-inputs/monolog_sample.txt b/tests/api-requests/Default turninator/test-inputs/monolog_sample.txt new file mode 100644 index 0000000..283c64e --- /dev/null +++ b/tests/api-requests/Default turninator/test-inputs/monolog_sample.txt @@ -0,0 +1 @@ +This is a sample argument about climate change. We need to take action now to reduce carbon emissions. The scientific evidence is overwhelming and shows that human activities are the primary cause of global warming. Therefore, we must implement stricter environmental regulations. \ No newline at end of file diff --git a/tests/api-requests/Default turninator/test-inputs/xaif_dialog.json b/tests/api-requests/Default turninator/test-inputs/xaif_dialog.json new file mode 100644 index 0000000..a6afb54 --- /dev/null +++ b/tests/api-requests/Default turninator/test-inputs/xaif_dialog.json @@ -0,0 +1,13 @@ +{ + "AIF": { + "nodes": [], + "edges": [], + "locutions": [], + "participants": [], + "schemefulfillments": [], + "descriptorfulfillments": [] + }, + "text": "Alice: We should invest in education.\nBob: I think healthcare is more important.", + "dialog": true, + "OVA": {} +} \ No newline at end of file diff --git a/tests/api-requests/Default turninator/test-inputs/xaif_minimal.json b/tests/api-requests/Default turninator/test-inputs/xaif_minimal.json new file mode 100644 index 0000000..f4879bd --- /dev/null +++ b/tests/api-requests/Default turninator/test-inputs/xaif_minimal.json @@ -0,0 +1,13 @@ +{ + "AIF": { + "nodes": [], + "edges": [], + "locutions": [], + "participants": [], + "schemefulfillments": [], + "descriptorfulfillments": [] + }, + "text": "This is a sample argument text that will be processed by the turninator.", + "dialog": false, + "OVA": {} +} \ No newline at end of file