我有以下Jasmine单元测试:
describe('getAlertsByUserId', function () {
it('should get alerts from api/Alert/bob when the username is bob', inject(function (AlertService, $httpBackend) {
$httpBackend.when('GET', 'api/Alert/bob').respond(mockAlerts);
var alerts = AlertService.getAlertsByUserId('bob');
$httpBackend.flush();
expect(alerts).toEqual(mockAlerts);
}));
});
Run Code Online (Sandbox Code Playgroud)
mockAlerts定义如下:
[{
date: new Date(2013, 5, 25),
description: '',
alertType: 'type1',
productDescription: 'product',
pack: 12,
size: 16,
unitOfMeasure: 'OZ',
category: 'cat1',
stage: 'C',
status: 'I'
}]
Run Code Online (Sandbox Code Playgroud)
当我在Karma中执行测试时,我得到"Expected [{date:... etc}]等于[{date:... etc}].我已经验证了两个对象是相同的(属性/值).我尝试删除Date对象,但无济于事.任何人?
我试图沿着路径绘制一个管子,而TubeGeometry对象似乎是为此而制作的.然而,有一个问题 - 我也希望半径沿着路径的每个点变化.基本上,我正在尝试绘制一个可变宽度的管.
我可以使用多个管子和圆筒来绘制它,但我不禁想到必须有一个更好的方法.