Dummy Dummy fetchDiscounts is a side effect, a dummy can replace it - - PowerPoint PPT Presentation

dummy dummy
SMART_READER_LITE
LIVE PREVIEW

Dummy Dummy fetchDiscounts is a side effect, a dummy can replace it - - PowerPoint PPT Presentation

Dummy Dummy fetchDiscounts is a side effect, a dummy can replace it for testing Dummy - Unit Test Dummy - Unit Test The object has nothing to do with the assertion of this test Stub Stub The service is not a core piece of our function, just


slide-1
SLIDE 1

Dummy

slide-2
SLIDE 2

Dummy

fetchDiscounts is a side effect, a dummy can replace it for testing

slide-3
SLIDE 3

Dummy - Unit Test

slide-4
SLIDE 4

Dummy - Unit Test

The object has nothing to do with the assertion of this test

slide-5
SLIDE 5

Stub

slide-6
SLIDE 6

Stub

The service is not a core piece of our function, just a side effect

slide-7
SLIDE 7

Stub - Unit Test

slide-8
SLIDE 8

Stub - unit test

The service is stubbed out to focus on the functionality of the method

slide-9
SLIDE 9

Fake

slide-10
SLIDE 10

Fake

Similar to a stub, but replaces functionality

slide-11
SLIDE 11

Fake - Jest Setup File

slide-12
SLIDE 12

Fake - Jest Setup File

slide-13
SLIDE 13

Fake - Unit Test

Call the function as normal, and utilize the local storage fake implementation

slide-14
SLIDE 14

Mock

Call the function as normal and utilize a mock to verify myService.placeOrder was called

slide-15
SLIDE 15

Mock

Call the function as normal and utilize a mock to verify myService.placeOrder was called

slide-16
SLIDE 16

Mock - Unit Test

slide-17
SLIDE 17

Mock - Unit Test

Make sure that place order has been called, even verify the parameters

slide-18
SLIDE 18

Unit Testing Decision Tree

slide-19
SLIDE 19

Unit Testing Decision Tree

slide-20
SLIDE 20

Unit Testing Decision Tree

slide-21
SLIDE 21

Unit Testing Decision Tree

slide-22
SLIDE 22

Unit Testing Decision Tree

slide-23
SLIDE 23

Unit Testing Decision Tree

slide-24
SLIDE 24

Unit Testing Decision Tree