Skip to content

Commit

Permalink
chore(liveness): remove distance check while connecting (#4499)
Browse files Browse the repository at this point in the history
* chore(liveness): remove distance check while connecting

* Create eleven-books-happen.md

* chore: waitForSessionInfo test
  • Loading branch information
thaddmt authored Oct 9, 2023
1 parent e5c946f commit cdf6154
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 25 deletions.
5 changes: 5 additions & 0 deletions .changeset/eleven-books-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@aws-amplify/ui-react-liveness": patch
---

chore(liveness): remove distance check while connecting
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,24 @@ describe('Liveness Machine', () => {
});

describe('notRecording', () => {
it('should reach waitForSessionInfo', async () => {
await transitionToInitializeLivenessStream(service);
await flushPromises(); // checkFaceDistanceBeforeRecording

service.send({
type: 'SET_SESSION_INFO',
data: {
sessionInfo: mockSessionInformation,
},
});
jest.advanceTimersToNextTimer(); // initializeLivenessStream
await flushPromises(); // { notRecording: 'waitForSessionInfo' }

expect(service.state.value).toEqual({
notRecording: 'waitForSessionInfo',
});
});

it('should reach recording state on START_RECORDING', async () => {
await transitionToInitializeLivenessStream(service);
await flushPromises(); // checkFaceDistanceBeforeRecording
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,33 +221,9 @@ export const livenessMachine = createMachine<LivenessContext, LivenessEvent>(
target: '#livenessMachine.recording',
cond: 'hasServerSessionInfo',
},
100: { target: 'detectFaceDistanceDuringLoading' },
100: { target: 'waitForSessionInfo' },
},
},
detectFaceDistanceDuringLoading: {
invoke: {
src: 'detectFaceDistanceWhileLoading',
onDone: {
target: 'checkFaceDistanceDuringLoading',
actions: ['updateFaceDistanceWhileLoading'],
},
},
},
checkFaceDistanceDuringLoading: {
always: [
{
target: 'failure',
cond: 'hasNotEnoughFaceDistanceBeforeRecording',
},
{
target: 'waitForSessionInfo',
},
],
},
failure: {
entry: 'sendTimeoutAfterFaceDistanceDelay',
type: 'final',
},
},
},
recording: {
Expand Down

0 comments on commit cdf6154

Please sign in to comment.