redux-saga-test-plan中testSaga和ExpectSaga之间的区别

时间:2019-09-17 00:13:51

标签: reactjs redux redux-saga redux-saga-test-plan

Sub Grouping2() Dim V As Long Dim oSh1 As Shape Dim oSh2 As Shape Dim Shapesarray() As Shape Dim oGroup As Shape Dim oSl As Slide Call rename On Error Resume Next If ActiveWindow.Selection.ShapeRange.Count < 2 Then MsgBox "Select at least 2 shapes" Exit Sub End If ReDim Shapesarray(1 To ActiveWindow.Selection.ShapeRange.Count) For V = 1 To ActiveWindow.Selection.ShapeRange.Count Set oSh1 = ActiveWindow.Selection.ShapeRange(V) Set oSh2 = ActiveWindow.Selection.ShapeRange(V + 1) If ShapesOverlap(oSh1, oSh2) = True Then Set Shapesarray(V) = oSh1 Set Shapesarray(V + 1) = oSh2 ' group items in array ActivePresentation.Slides(1).Shapes.Range(Array(oSh1.Name, oSh2.Name)).Group 'else move to next shape in selction range and check End If V = V + 1 Next V End Sub Sub rename() Dim osld As Slide Dim oshp As Shape Dim L As Long Set osld = ActiveWindow.Selection.SlideRange(1) For Each oshp In osld.Shapes If Not oshp.Type = msoPlaceholder Then L = L + 1 oshp.Name = "myShape" & CStr(L) End If Next oshp End Sub 用于集成测试,expectSaga用于一般声明是否正确?

实际上,我可以在所有测试中互换使用它们,所以我对何时使用它们感到有些困惑。

1 个答案:

答案 0 :(得分:3)

我认为单元测试[1]下自述文件中的副标题行是有关何时使用[a-zA-Z](\d{4})[A-Z]([+\-]\d{2}\.\d{2})K([+\-][0-9]+)\-([a-zA-Z]+) testSaga的最简洁的解释:

  

如果要确保您的传奇能够产生特定类型的效果   可以按特定顺序使用testSaga函数。

如果您不关心此详细程度,尤其是订购位,那么expectSaga的刚性会降低,因此对您的sagas将来的更改不那么脆弱。但是在某些情况下,您需要非常确切地确定哪种效果以哪种顺序,在这种情况下,您应该使用expectSaga

[1] https://github.com/jfairbank/redux-saga-test-plan#unit-testing