Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: attempt to mock SQS in hrmservice #654

Draft
wants to merge 60 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
7e0a00f
refactor: move contacts and cases types to HrmTypes module
GPaoloni May 3, 2024
0c62562
chore: license header
GPaoloni May 3, 2024
03d3a21
chore: moved hrm types to own package hrm-types
GPaoloni May 6, 2024
02e996f
chore: pull hrm-types from correct package
GPaoloni May 6, 2024
9e44933
chore: added dependencies to search-index-consumer
GPaoloni May 6, 2024
b3a140c
chore: move types around to ease lambda implementation
GPaoloni May 7, 2024
e3d37ca
chore: implement search-index-consumer indexing
GPaoloni May 7, 2024
bd80def
Merge remote-tracking branch 'origin/master' into gian_CHI-2717-2
GPaoloni May 7, 2024
d5ec170
chore: fix TS complaints
GPaoloni May 7, 2024
43456e2
fix: add emtpy parent if missing in contact document
GPaoloni May 8, 2024
83c1777
fix: wrong import
GPaoloni May 8, 2024
9417567
chore: added logic to update documents via elasticsearch client
GPaoloni May 10, 2024
2bc2d8e
chore: update hrm-search-config package to generate case update scrip…
GPaoloni May 10, 2024
340bdd2
chore: search-index-consumer rework
GPaoloni May 10, 2024
7cf998c
fix: small TS errors
GPaoloni May 10, 2024
f5b3bef
debug
GPaoloni May 10, 2024
c0cabb1
fix: contemplate case where case index payloads is undefined
GPaoloni May 10, 2024
8097a42
chore: fix unit tests
GPaoloni May 13, 2024
a10662d
debug logs
GPaoloni May 13, 2024
08e28c9
debug
GPaoloni May 13, 2024
c59db2a
chore: factor out convertToScriptUpdate logic
GPaoloni May 14, 2024
4101c0c
chore: refactor search-index-consumer to improve redability
GPaoloni May 14, 2024
7df50bd
chore: lint
GPaoloni May 14, 2024
06f0254
chore: removed comments
GPaoloni May 14, 2024
b208991
chore: moved channelTypes constants to hrm-types module
GPaoloni May 16, 2024
acb1245
chore fetch transcripts from S3
GPaoloni May 16, 2024
0982e55
debug
GPaoloni May 16, 2024
9ef239b
chore: add packages/s3-client to tsconfig.build
GPaoloni May 16, 2024
c0a62d1
chore: remove debug logs
GPaoloni May 17, 2024
8387804
chore: add support for parameterized ES config
GPaoloni May 21, 2024
d6e187b
chore: provide ssm parameter name from env vars to ES config
GPaoloni May 21, 2024
9a2703f
Merge remote-tracking branch 'origin/gian_CHI-2717-2' into gian_CHI-2…
GPaoloni May 21, 2024
7c51980
chore: rename env var for ES config
GPaoloni May 21, 2024
2178928
chore: added hrm-search-config package to hrm-core
GPaoloni May 22, 2024
0b8307e
chore: added wrapper to publish index-search messages to correspondin…
GPaoloni May 22, 2024
7913bbf
Merge remote-tracking branch 'origin/master' into gian_CHI-2723
GPaoloni May 22, 2024
0d4f1ec
chore: added logic to publish updates on contacts into corresponding …
GPaoloni May 23, 2024
b165e3f
chore: debug logs
GPaoloni May 23, 2024
5e4c468
chore: copy hrm packages at build time
GPaoloni May 23, 2024
029654c
chore: add message group id to sqs calls
GPaoloni May 27, 2024
7262aaf
chore: convertToIndexDocument only filters out undefined values
GPaoloni May 27, 2024
06bfd60
chore: trigger re-index on conversation media updates
GPaoloni May 27, 2024
f8b494f
chore: fix unit tests
GPaoloni May 29, 2024
de33345
chore: added unit tests
GPaoloni May 29, 2024
e655b60
chore: fix service tests
GPaoloni May 29, 2024
8ca4f42
chore: added logic to publish updates on cases into index-search queue
GPaoloni May 30, 2024
50d068e
chore: added logic to publish updates on case sections into index-sea…
GPaoloni May 30, 2024
beb8680
chore: fix unit tests
GPaoloni May 31, 2024
42536fb
Merge remote-tracking branch 'origin/gian_CHI-2724' into gian_CHI-2725
GPaoloni May 31, 2024
28a47dc
chore: naming nit
GPaoloni May 31, 2024
c7ba6c5
chore: PR feedback (naming nit)
GPaoloni May 31, 2024
b7ef6ee
chore: add support for deleteDocument OP in elasticsearch client package
GPaoloni May 31, 2024
f553d18
chore: add logic to handle remove case op in search-index-consumer
GPaoloni May 31, 2024
d0c1f4a
chore: trigger 'remove case from index' op when a case is deleted in HRM
GPaoloni May 31, 2024
51ffc2d
chore: handle errors, avoid publishing if there's no record
GPaoloni Jun 3, 2024
c228b35
chore: fix unit tests
GPaoloni Jun 4, 2024
9f33296
chore: contemplate possible undefined deleted case
GPaoloni Jun 4, 2024
ea0dcd4
chore: add FF to avoid introducing breaking code
GPaoloni Jun 4, 2024
2af5817
Merge remote-tracking branch 'origin/gian_CHI-2724' into gian_CHI-2725
GPaoloni Jun 4, 2024
0b90edc
chore: attempt to mock SQS in hrmservice
GPaoloni Jun 5, 2024
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
Prev Previous commit
Next Next commit
chore: added unit tests
  • Loading branch information
GPaoloni committed May 29, 2024
commit de33345f91a936648941bf04d1a34168b932d721
12 changes: 12 additions & 0 deletions hrm-domain/hrm-core/unit-tests/contact/contactService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ describe('createContact', () => {
identifierId: 1,
});

expect(publishToSearchIndexSpy).toHaveBeenCalled();
expect(returnValue).toStrictEqual(mockContact);
});

Expand Down Expand Up @@ -173,6 +174,7 @@ describe('createContact', () => {
identifierId: 2,
});

expect(publishToSearchIndexSpy).toHaveBeenCalled();
expect(returnValue).toStrictEqual(mockContact);
});

Expand Down Expand Up @@ -207,6 +209,7 @@ describe('createContact', () => {
identifierId: undefined,
});

expect(publishToSearchIndexSpy).toHaveBeenCalled();
expect(returnValue).toStrictEqual(mockContact);
});

Expand All @@ -228,6 +231,7 @@ describe('createContact', () => {
identifierId: 1,
});

expect(publishToSearchIndexSpy).toHaveBeenCalled();
expect(returnValue).toStrictEqual(mockContact);
});

Expand All @@ -250,6 +254,7 @@ describe('createContact', () => {
identifierId: 1,
});

expect(publishToSearchIndexSpy).toHaveBeenCalled();
expect(returnValue).toStrictEqual(mockContact);
});
});
Expand All @@ -266,6 +271,8 @@ describe('connectContactToCase', () => {
'4321',
ALWAYS_CAN.user.workerSid,
);

expect(publishToSearchIndexSpy).toHaveBeenCalled();
expect(result).toStrictEqual(mockContact);
});

Expand All @@ -276,6 +283,7 @@ describe('connectContactToCase', () => {
expect(
connectContactToCase(accountSid, '1234', '4321', ALWAYS_CAN),
).rejects.toThrow();
expect(publishToSearchIndexSpy).not.toHaveBeenCalled();
});
});

Expand Down Expand Up @@ -310,6 +318,8 @@ describe('patchContact', () => {
samplePatch,
ALWAYS_CAN,
);

expect(publishToSearchIndexSpy).toHaveBeenCalled();
expect(result).toStrictEqual(mockContact);
expect(patchSpy).toHaveBeenCalledWith(accountSid, '1234', true, {
updatedBy: contactPatcherSid,
Expand All @@ -333,6 +343,8 @@ describe('patchContact', () => {
const patchSpy = jest.fn();
jest.spyOn(contactDb, 'patch').mockReturnValue(patchSpy);
patchSpy.mockResolvedValue(undefined);

expect(publishToSearchIndexSpy).not.toHaveBeenCalled();
expect(
patchContact(accountSid, contactPatcherSid, true, '1234', samplePatch, ALWAYS_CAN),
).rejects.toThrow();
Expand Down
Loading