diff --git a/tests/javascript/data/invalid_confidence_scores.stj.json b/tests/javascript/data/invalid_confidence_scores.stj.json index b82dd6c..fcce3e0 100644 --- a/tests/javascript/data/invalid_confidence_scores.stj.json +++ b/tests/javascript/data/invalid_confidence_scores.stj.json @@ -1,4 +1,6 @@ { + "stj": { + "version": "0.6.0", "metadata": { "transcriber": { "name": "TestTranscriber", @@ -12,7 +14,7 @@ "start": 0.0, "end": 5.0, "text": "Confidence test", - "confidence": 1.2, // Invalid confidence score + "confidence": 1.2, "words": [ { "start": 0.0, @@ -31,4 +33,4 @@ ] } } - \ No newline at end of file +} \ No newline at end of file diff --git a/tests/javascript/data/invalid_language.stj.json b/tests/javascript/data/invalid_language.stj.json index f4fc833..a9c90b6 100644 --- a/tests/javascript/data/invalid_language.stj.json +++ b/tests/javascript/data/invalid_language.stj.json @@ -1,13 +1,19 @@ { + "stj": { + "version": "0.6.0", "metadata": { "transcriber": { "name": "TestTranscriber", "version": "1.0" }, "created_at": "2023-10-21T12:00:00Z", - "languages": ["xx"], // Invalid language code + "languages": [ + "xx" + ], "source": { - "languages": ["en"] + "languages": [ + "en" + ] } }, "transcript": { @@ -16,9 +22,9 @@ "start": 0.0, "end": 5.0, "text": "Sample text.", - "language": "yy" // Invalid language code + "language": "yy" } ] } } - \ No newline at end of file +} \ No newline at end of file diff --git a/tests/javascript/data/invalid_speaker_id.stj.json b/tests/javascript/data/invalid_speaker_id.stj.json index 65ff276..82f31a6 100644 --- a/tests/javascript/data/invalid_speaker_id.stj.json +++ b/tests/javascript/data/invalid_speaker_id.stj.json @@ -1,4 +1,6 @@ { + "stj": { + "version": "0.6.0", "metadata": { "transcriber": { "name": "TestTranscriber", @@ -18,9 +20,9 @@ "start": 0.0, "end": 3.0, "text": "Hello, this is a test.", - "speaker_id": "Speaker2" // Invalid speaker_id + "speaker_id": "Speaker2" } ] } } - \ No newline at end of file +} \ No newline at end of file diff --git a/tests/javascript/data/invalid_word_timing_mode.stj.json b/tests/javascript/data/invalid_word_timing_mode.stj.json index 35348d1..0198bd8 100644 --- a/tests/javascript/data/invalid_word_timing_mode.stj.json +++ b/tests/javascript/data/invalid_word_timing_mode.stj.json @@ -1,4 +1,6 @@ { + "stj": { + "version": "0.6.0", "metadata": { "transcriber": { "name": "TestTranscriber", @@ -19,10 +21,9 @@ "end": 1.0, "text": "Hello" } - // Missing "world" in the words array ] } ] } } - \ No newline at end of file +} \ No newline at end of file diff --git a/tests/javascript/data/overlapping_segments.stj.json b/tests/javascript/data/overlapping_segments.stj.json index 10bd2bd..13c0be5 100644 --- a/tests/javascript/data/overlapping_segments.stj.json +++ b/tests/javascript/data/overlapping_segments.stj.json @@ -1,4 +1,6 @@ { + "stj": { + "version": "0.6.0", "metadata": { "transcriber": { "name": "TestTranscriber", @@ -21,4 +23,4 @@ ] } } - \ No newline at end of file +} \ No newline at end of file diff --git a/tests/javascript/data/word_outside_segment_timings.stj.json b/tests/javascript/data/word_outside_segment_timings.stj.json index 7d5c2c9..53a0ade 100644 --- a/tests/javascript/data/word_outside_segment_timings.stj.json +++ b/tests/javascript/data/word_outside_segment_timings.stj.json @@ -1,4 +1,6 @@ { + "stj": { + "version": "0.6.0", "metadata": { "transcriber": { "name": "TestTranscriber", @@ -14,13 +16,13 @@ "text": "Timing mismatch", "words": [ { - "start": -1.0, // Before segment start + "start": -1.0, "end": 1.0, "text": "Timing" }, { "start": 1.0, - "end": 4.0, // After segment end + "end": 4.0, "text": "mismatch" } ] @@ -28,4 +30,4 @@ ] } } - \ No newline at end of file +} \ No newline at end of file diff --git a/tests/javascript/data/words_overlap_or_out_of_order.stj.json b/tests/javascript/data/words_overlap_or_out_of_order.stj.json index a6698ba..1dcb0cb 100644 --- a/tests/javascript/data/words_overlap_or_out_of_order.stj.json +++ b/tests/javascript/data/words_overlap_or_out_of_order.stj.json @@ -1,4 +1,6 @@ { + "stj": { + "version": "0.6.0", "metadata": { "transcriber": { "name": "TestTranscriber", @@ -19,7 +21,7 @@ "text": "Overlap" }, { - "start": 1.0, // Starts before the previous word ends + "start": 1.0, "end": 2.0, "text": "test" } @@ -28,4 +30,4 @@ ] } } - \ No newline at end of file +} \ No newline at end of file diff --git a/tests/javascript/data/zero_duration_word_without_flag.stj.json b/tests/javascript/data/zero_duration_word_without_flag.stj.json index 942b386..6810d16 100644 --- a/tests/javascript/data/zero_duration_word_without_flag.stj.json +++ b/tests/javascript/data/zero_duration_word_without_flag.stj.json @@ -1,4 +1,6 @@ { + "stj": { + "version": "0.6.0", "metadata": { "transcriber": { "name": "TestTranscriber", @@ -17,7 +19,6 @@ "start": 1.0, "end": 1.0, "text": "Zero" - // Missing 'word_duration' set to 'zero' in 'additional_info' }, { "start": 1.0, @@ -29,4 +30,4 @@ ] } } - \ No newline at end of file +} \ No newline at end of file diff --git a/tests/javascript/test_stj_validator.test.js b/tests/javascript/test_stj_validator.test.js index b713663..eba89aa 100644 --- a/tests/javascript/test_stj_validator.test.js +++ b/tests/javascript/test_stj_validator.test.js @@ -1,3 +1,5 @@ +jest.setTimeout(10000); // Increase timeout to 10 seconds + const { exec } = require('child_process'); const path = require('path'); @@ -20,7 +22,7 @@ function runValidatorTest(stjFileName, expectedErrorMessage, done) { } test('Valid STJ file passes validation', (done) => { - const stjFile = path.join(__dirname, '..', '..', 'examples', 'simple.stj.json'); + const stjFile = path.join(__dirname, '..', '..', 'examples', 'latest', 'simple.stj.json'); exec(`node ${validator} ${stjFile} ${schemaFile}`, (error, stdout, stderr) => { expect(error).toBeNull(); expect(stdout).toContain('All validation checks passed.');