zarm
Version:
基于 React 的移动端UI库
32 lines • 903 B
JavaScript
import showOriginButton from '../../utils/showOriginButton';
import { originImages } from '../../../../tests/testData/images';
describe('showOriginButton', function () {
it('should return true if image has originSrc', function () {
var actual = showOriginButton(originImages, 1);
expect(actual).toBeTruthy();
});
it('should return false if image does not have originSrc', function () {
var actual = showOriginButton([{
src: 'a'
}, {
src: 'b'
}], 0);
expect(actual).toBeFalsy();
});
it('should return false if image not found', function () {
var actual = showOriginButton([{
src: 'a'
}, {
src: 'b'
}], 2);
expect(actual).toBeFalsy();
});
it('should return false if index is undefined', function () {
var actual = showOriginButton([{
src: 'a'
}, {
src: 'b'
}]);
expect(actual).toBeFalsy();
});
});