File timeFormat.spec.js
has 393 lines of code (exceeds 250 allowed). Consider refactoring.
import timeFormat, { QlikTimeToDate } from '../timeFormat';
* PLEASE NOTE / WARNING: THIS FUNCTION *MAY* HAVE FLOATING POINT ERRORS
* IT MIGHT BE OFF BY MILLISECONDS.
Similar blocks of code found in 4 locations. Consider refactoring.
it('in short form', () => {
n = timeFormat('MMM');
expect(n(_0)).to.equal('Jan');
expect(n(_1)).to.equal('Feb');
expect(n(_2)).to.equal('Mar');
plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 142..156 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 158..172 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 190..204 Similar blocks of code found in 4 locations. Consider refactoring.
it('as padded number', () => {
n = timeFormat('MM');
expect(n(_0)).to.equal('01');
expect(n(_1)).to.equal('02');
expect(n(_2)).to.equal('03');
plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 142..156 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 174..188 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 190..204 Similar blocks of code found in 4 locations. Consider refactoring.
it('in long form', () => {
n = timeFormat('MMMM');
expect(n(_0)).to.equal('January');
expect(n(_1)).to.equal('February');
expect(n(_2)).to.equal('March');
plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 142..156 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 158..172 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 174..188 Similar blocks of code found in 4 locations. Consider refactoring.
it('as number', () => {
n = timeFormat('M');
expect(n(_0)).to.equal('1');
expect(n(_1)).to.equal('2');
expect(n(_2)).to.equal('3');
plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 158..172 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 174..188 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 190..204 Similar blocks of code found in 8 locations. Consider refactoring.
it('as number (small)', () => {
n = timeFormat('w');
expect(n(mon)).to.equal('0');
expect(n(tue)).to.equal('1');
expect(n(wed)).to.equal('2');
plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 220..229 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 242..251 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 253..262 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 264..273 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 275..284 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 286..295 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 297..306 Similar blocks of code found in 8 locations. Consider refactoring.
it('in long form (small)', () => {
n = timeFormat('wwww');
expect(n(mon)).to.equal('Monday');
expect(n(tue)).to.equal('Tuesday');
expect(n(wed)).to.equal('Wednesday');
plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 220..229 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 231..240 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 242..251 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 253..262 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 264..273 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 275..284 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 286..295 Similar blocks of code found in 8 locations. Consider refactoring.
it('as number', () => {
n = timeFormat('W');
expect(n(mon)).to.equal('0');
expect(n(tue)).to.equal('1');
expect(n(wed)).to.equal('2');
plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 231..240 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 242..251 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 253..262 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 264..273 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 275..284 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 286..295 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 297..306 Similar blocks of code found in 8 locations. Consider refactoring.
it('in long form', () => {
n = timeFormat('WWWW');
expect(n(mon)).to.equal('Monday');
expect(n(tue)).to.equal('Tuesday');
expect(n(wed)).to.equal('Wednesday');
plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 220..229 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 231..240 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 242..251 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 253..262 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 264..273 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 275..284 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 297..306 Similar blocks of code found in 8 locations. Consider refactoring.
it('as padded number (small)', () => {
n = timeFormat('ww');
expect(n(mon)).to.equal('00');
expect(n(tue)).to.equal('01');
expect(n(wed)).to.equal('02');
plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 220..229 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 231..240 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 242..251 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 264..273 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 275..284 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 286..295 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 297..306 Similar blocks of code found in 8 locations. Consider refactoring.
it('in short form (small)', () => {
n = timeFormat('www');
expect(n(mon)).to.equal('Mon');
expect(n(tue)).to.equal('Tue');
expect(n(wed)).to.equal('Wed');
plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 220..229 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 231..240 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 242..251 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 253..262 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 264..273 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 286..295 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 297..306 Similar blocks of code found in 8 locations. Consider refactoring.
it('as padded number', () => {
n = timeFormat('WW');
expect(n(mon)).to.equal('00');
expect(n(tue)).to.equal('01');
expect(n(wed)).to.equal('02');
plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 220..229 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 231..240 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 253..262 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 264..273 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 275..284 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 286..295 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 297..306 Similar blocks of code found in 8 locations. Consider refactoring.
it('in short form', () => {
n = timeFormat('WWW');
expect(n(mon)).to.equal('Mon');
expect(n(tue)).to.equal('Tue');
expect(n(wed)).to.equal('Wed');
plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 220..229 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 231..240 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 242..251 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 253..262 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 275..284 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 286..295 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 297..306 Similar blocks of code found in 3 locations. Consider refactoring.
it('as number', () => {
expect(n.format('h', midnight)).to.equal('0');
expect(n.format('H', midnight)).to.equal('0');
expect(n.format('h', preNoon)).to.equal('11');
expect(n.format('H', preNoon)).to.equal('11');
plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 379..384 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 419..425 Similar blocks of code found in 3 locations. Consider refactoring.
it('as padded number', () => {
expect(n.format('hh', midnight)).to.equal('00');
expect(n.format('HH', midnight)).to.equal('00');
expect(n.format('hh', preNoon)).to.equal('11');
expect(n.format('HH', preNoon)).to.equal('11');
plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 372..377 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 419..425 Similar blocks of code found in 3 locations. Consider refactoring.
it('as number', () => {
expect(n.format('s', midnight)).to.equal('0');
expect(n.format('S', midnight)).to.equal('0');
expect(n.format('s', midnight59)).to.equal('59');
plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 372..377 plugins/q/src/formatter/__tests__/timeFormat.spec.js on lines 379..384 There are no issues that match your filters.