Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Set update schedule for GitHub Actions

version: 2
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

name: Benchmark CI
env:
GITHUB_TOKEN: ${{ secrets.GH_WRITE_TOKEN }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/codacy.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/milestone.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

name: Milestone Workflow

on:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/njsscan.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

name: Release Workflow

on:
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

ARG BUILD_IMAGE=node:20-bullseye
ARG RUN_IMAGE=gcr.io/distroless/nodejs20-debian11:nonroot

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- SPDX-License-Identifier: Apache-2.0 -->

# 5. Transaction Aggregation and Decisioning Processor (TADP)

The sequence diagram below for the Transaction Aggregation and Decisioning Processor
Expand Down
40 changes: 40 additions & 0 deletions __tests__/unit/typology.helper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,45 @@ describe('TADProc Service', () => {
expect(result).toEqual({ review: false, typologyResult: [] });
// expect(responseSpy).toHaveBeenCalledTimes(1);
});

it('should repond with review false if typology result not match any typologies from networkmap', async () => {
responseSpy.mockRestore();
const expectedReq = getMockTransaction();
const ruleResults: RuleResult[] = [{ id: '', cfg: '', subRuleRef: '', reason: '' }];
const networkMap = getMockNetworkMap();
const typologyResult: TypologyResult = getMockTypologyResult(ruleResults);
const result = await helpers.handleTypologies(expectedReq, networkMap, typologyResult);
expect(result).toEqual({
review: false,
typologyResult: [
{
result: 50,
id: '[email protected]',
cfg: '1.0',
workflow: { alertThreshold: '0', interdictionThreshold: '' },
ruleResults: [{ id: '', cfg: '', subRuleRef: '', reason: '' }],
},
],
});
});

it('should respond with empty results if no typologies', async () => {
responseSpy.mockRestore();
jest.spyOn(databaseManager, 'addOneGetCount').mockImplementation((..._args: unknown[]): Promise<number> => {
return Promise.resolve(-1);
});
const expectedReq = getMockTransaction();

const ruleResults: RuleResult[] = [{ id: '', cfg: '', subRuleRef: '', reason: '' }];
const networkMap = getMockNetworkMapNoMessages();
const typology = { ...networkMap.messages[0].typologies[0] };
typology.id = '[email protected]';
networkMap.messages[0].typologies.push(typology);

const typologyResult: TypologyResult = getMockTypologyResult(ruleResults);

const result = await helpers.handleTypologies(expectedReq, networkMap, typologyResult);
expect(result).toEqual({ review: false, typologyResult: [] });
});
});
});