rxjs-marbles测试没有期望

时间:2018-11-10 12:56:34

标签: angular rxjs angular-test jasmine-marbles rxjs-marbles

我使用rxjs-marbles在我的Angular 7应用中测试可观察性。但是看来jasmine无法将Sub CompareCopy() Dim ws1 As Worksheet Set ws1 = ActiveWorkbook.Worksheets("Sheet1") Dim ws2 As Worksheet Set ws2 = ActiveWorkbook.Worksheets("Sheet1") 'You can change the output datas sheet. Dim lrow As Long Dim i As Long Dim j As Long Dim lCol As Long Dim k As Long Dim Header1 As String Dim Header2 As String Dim Header3 As String Dim ColumnOutput As String k = 2 'first row where output data will be placed lCol = ws1.Cells(1, Columns.Count).End(xlToLeft).Column 'find last column lrow = ws1.Cells(Rows.Count, 27).End(xlUp).Row 'Find last row ColumnOutput = lCol 'Set Column where output should start, default is the last column of your original table. ws2.Cells(k - 1, ColumnOutput + 2) = "Date" 'Place where "Date" will be printed ws2.Cells(k - 1, ColumnOutput + 3) = "Time" 'Place where "Time" will be printed ws2.Cells(k - 1, ColumnOutput + 4) = "Value" 'Place where "Value" will be printed For i = 2 To lrow 'Loop through each row For j = 28 To lCol 'Loop through each Column If -3 > ws1.Cells(i, j).Value Then 'If current table value is less than -3 then copy ws2.Cells(k, ColumnOutput + 2).Value = ws1.Cells(i, 27).Value 'Copy Date ws2.Cells(k, ColumnOutput + 2).NumberFormat = "dd-mmm-yy" 'Format time value to correct time ws2.Cells(k, ColumnOutput + 3).Value = ws1.Cells(1, j).Value 'Copy Time ws2.Cells(k, ColumnOutput + 3).NumberFormat = "hh:mm" 'Format time value to correct time ws2.Cells(k, ColumnOutput + 4).Value = ws1.Cells(i, j).Value 'Copy Value k = k + 1 End If Next j Next i End Sub 识别为期望值。

我有以下测试:

m.expect

当我运行它时,控制台出现错误:

it('should see expectations', marbles(m => {
  const source: Observable<Message> = m.hot('^a--b--c');
  m.expect(source).toBeObservable('-a--b--c');
}));

在浏览器输出中,我的测试还带有以下前缀:

ERROR: 'Spec 'FeatureFlagsService should see expectations' has no expectations.'

添加SPEC HAS NO EXPECTATIONS should see expectations 可以解决此问题,但这并不是我想要的方式。

如何将expect(true).toBe(true);注册为茉莉花的期望值?

1 个答案:

答案 0 :(得分:0)

它实际上是由lib自己解决的。我在github上创建了一个问题,该问题很快得到解决:https://github.com/cartant/rxjs-marbles/issues/51