Skip to content

Commit 55c6038

Browse files
committed
MAGETWO-64413: [GITHUB] Invalid expiration year validator #8482
- Added js unit test for the year validator
1 parent 7f65556 commit 55c6038

File tree

1 file changed

+24
-0
lines changed
  • dev/tests/js/jasmine/tests/app/code/Magento/Payment/base/js/model/credit-card-validation

1 file changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
define([
7+
'jquery',
8+
'jquery/validate',
9+
'Magento_Payment/js/model/credit-card-validation/validator'
10+
], function ($) {
11+
'use strict';
12+
13+
describe('Magento_Payment/js/model/credit-card-validation/validator', function () {
14+
15+
it('Check credit card expiration year validator.', function () {
16+
var year = new Date().getFullYear();
17+
18+
expect($.validator.methods['validate-card-year']('1234')).toBeFalsy();
19+
expect($.validator.methods['validate-card-year']('')).toBeFalsy();
20+
expect($.validator.methods['validate-card-year']((year - 1).toString())).toBeFalsy();
21+
expect($.validator.methods['validate-card-year']((year + 1).toString())).toBeTruthy();
22+
});
23+
});
24+
});

0 commit comments

Comments
 (0)