Skip to content

Commit

Permalink
Refactor registry set calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Kaisermann committed Dec 27, 2018
1 parent 1b16caa commit be754ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 6 additions & 2 deletions packages/components/Printable/Printable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ it('should return a resolved promise when `print({ print_to_paper: false })` and
});

it('should display a retry dialog in case of a printing error', () => {
Registry.set('$Printer.panel.shouldFail', true);
Registry.set(draft => {
draft.$Printer.panel.shouldFail = true;
});

printable = newPrintable();
printable.print();
Expand All @@ -67,7 +69,9 @@ it('should display a retry dialog in case of a printing error', () => {
});

it('should dispatch a "finish" event in case of not wanting to retry printing', () => {
Registry.set('$Printer.panel.shouldFail', true);
Registry.set(draft => {
draft.$Printer.panel.shouldFail = true;
});

printable = newPrintable();
printable.print();
Expand Down
7 changes: 3 additions & 4 deletions packages/pos/drivers/cancellation/simulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ export function setup(Cancellation) {
: Registry.get().$Cancellation.cancelledAmount;

Cancellation.doCancellation = () => {
Registry.set(
'$Cancellation.cancelledAmount',
Registry.get().$Payment.authorizedAmount,
);
Registry.set(draft => {
draft.$Cancellation.cancelledAmount = draft.$Payment.authorizedAmount;
});
Cancellation.cancellationDone();
};
}

0 comments on commit be754ab

Please sign in to comment.