Skip to content

Commit

Permalink
- исправлена ошибка замены ожидаемого события фактически в интеграцио…
Browse files Browse the repository at this point in the history
…нных тестах (special thanks @bobyboba18, @GeorgeFloyd_Official).
  • Loading branch information
DmitryOffsec committed Aug 21, 2024
1 parent 571d320 commit ab56269
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 3.19.0 (Pre-Release)

- исправлена ошибка замены ожидаемого события фактически в интеграционных тестах (special thanks @Bobyboba18, @GeorgeFloyd_Official).

## 3.18.0 (Release - July 31, 2024)

- добавлена базовая поддержка правил агрегации: создание из шаблона, тестирование, заполнение метаинформации, валидация через тесты, описание и локализация (special thanks @Protenil, @hiddenbymeeee);
Expand Down
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Language client",
"author": "Dmitry Fedosov (@DmitryOffsec)",
"license": "MIT",
"version": "3.18.0",
"version": "3.19.0",
"repository": {
"type": "git",
"url": "https://github.com/Security-Experts-Community/vscode-xp"
Expand Down
12 changes: 10 additions & 2 deletions client/src/models/tests/correlationUnitTestsRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { UnitTestOutputParser } from './unitTestOutputParser';
import { SiemjManager } from '../siemj/siemjManager';
import { Log } from '../../extension';
import { XpException } from '../xpException';
import { RegExpHelper } from '../../helpers/regExpHelper';

export class CorrelationUnitTestsRunner implements UnitTestRunner {

Expand Down Expand Up @@ -114,9 +115,16 @@ export class CorrelationUnitTestsRunner implements UnitTestRunner {
// Обновление статуса теста.
test.setStatus(TestStatus.Success);

// TODO: кажется, лишний метод. Разобраться.
// const expectedResult = this._outputParser.parseSuccessOutput(output.output);

// Вывод теста содержит событие, подходящее под expect секцию, поэтому извлекаем его и очищаем, как код теста.
const expectedResult = this._outputParser.parseSuccessOutput(output.output);
const clearedResult = TestHelper.cleanModularTestResult(expectedResult);
const jsons = RegExpHelper.parseJsonsFromMultilineString(output.output);
if(jsons.length != 1) {
throw new XpException("The actual event could not be parsed");
}

const clearedResult = TestHelper.cleanModularTestResult(jsons[0]);

// Так как тест успешный, то можно сохранить отформатированный результат.
test.setOutput(clearedResult);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Dmitry Fedosov (@DmitryOffsec)",
"icon": "resources/xp.png",
"license": "MIT",
"version": "3.18.0",
"version": "3.19.0",
"repository": {
"type": "git",
"url": "https://github.com/Security-Experts-Community/vscode-xp"
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "server",
"description": "Language server",
"version": "3.18.0",
"version": "3.19.0",
"author": "Dmitry Fedosov (@DmitryOffsec)",
"license": "MIT",
"engines": {
Expand Down

0 comments on commit ab56269

Please sign in to comment.