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

PRMT-4747 #93

Merged
merged 2 commits into from
Apr 30, 2024
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
4 changes: 2 additions & 2 deletions src/__tests__/app.integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ describe('app', () => {
});

const getPatientResponseAfterDeletion = await callGetPatient(nhsNumber);
expect(getPatientResponseAfterDeletion.status).toBe(404);
expect(getPatientResponseAfterDeletion.status).toBe(200);

const softDeletedRecords = await db.queryTableByConversationId(
inboundConversationId,
Expand Down Expand Up @@ -700,7 +700,7 @@ describe('app', () => {
});

const getPatientResponseAfterDeletion = await callGetPatient(nhsNumber);
expect(getPatientResponseAfterDeletion.status).toBe(404);
expect(getPatientResponseAfterDeletion.status).toBe(200);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import { createCore } from '../ehr-core-repository';
import { EhrTransferTracker } from '../dynamo-ehr-transfer-tracker';
import { markFragmentAsReceivedAndCreateItsParts } from '../ehr-fragment-repository';
import { HealthRecordNotFoundError, MessageNotFoundError } from '../../../errors/errors';
import { buildCore } from '../../../models/core';
import { getEpochTimeInSecond } from '../../time';
import moment from 'moment-timezone';

jest.mock('../../../middleware/logging');
Expand Down Expand Up @@ -251,20 +249,6 @@ describe('ehr-conversation-repository', () => {
.rejects.toThrowError(MessageNotFoundError);
});

it('should throw an error if the only existing messages were deleted', async () => {
// given
const conversationId = uuid().toUpperCase();
const messageId = uuid().toUpperCase();
const item = { ...buildCore(conversationId, messageId), DeletedAt: getEpochTimeInSecond() };

await db.writeItemsInTransaction([item]);

// when
await expect(() => getMessageIdsForConversation(conversationId))
// then
.rejects.toThrowError(MessageNotFoundError);
});

it('should return health record extract message id given a conversation id for a small health record', async () => {
// given
const messageId = uuid().toUpperCase();
Expand Down Expand Up @@ -366,7 +350,6 @@ describe('ehr-conversation-repository', () => {
const messageId = uuid().toUpperCase();
const conversationId = makeConversationIdForTest();
const fragmentIds = [uuid().toUpperCase(), uuid().toUpperCase(), uuid().toUpperCase()];

await createCompleteRecordForTest(nhsNumber, conversationId, messageId, fragmentIds);

// when
Expand All @@ -375,7 +358,7 @@ describe('ehr-conversation-repository', () => {
// then
const healthRecordStatusAfterwards = await getConversationStatus(conversationId);
expect(result).toEqual([conversationId]);
expect(healthRecordStatusAfterwards).toEqual(HealthRecordStatus.NOT_FOUND);
expect(healthRecordStatusAfterwards).toEqual(HealthRecordStatus.COMPLETE);

const deletedRecords = await db.queryTableByConversationId(
conversationId,
Expand Down
4 changes: 2 additions & 2 deletions src/services/database/dynamo-ehr-transfer-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class EhrTransferTracker {
}
}

async queryTableByNhsNumber(nhsNumber, includeDeletedRecord = false) {
async queryTableByNhsNumber(nhsNumber, includeDeletedRecord = true) {
const params = {
TableName: this.tableName,
IndexName: 'NhsNumberSecondaryIndex',
Expand Down Expand Up @@ -124,7 +124,7 @@ export class EhrTransferTracker {
async queryTableByConversationId(
inboundConversationId,
recordType = RecordType.ALL,
includeDeletedRecord = false
includeDeletedRecord = true
) {
const params = {
TableName: this.tableName,
Expand Down
Loading