import { getEChartOptions } from './utils';
import { palette } from '@waldur/slurm/details/constants';

const usages = require('./fixtures/usages.json');
const userUsages = require('./fixtures/user-usages.json');
const chartSpec = require('./fixtures/chart-spec.json');
const eChartOption = require('./fixtures/echart-option.json');

describe('SLURM allocation usage chart formatter', () => {
  it('parses data and returns eChart option correctly', () => {
    expect(getEChartOptions(chartSpec, usages, userUsages)).toEqual({
      ...eChartOption,
      color: palette,
    });
  });
});

import { palette } from '@waldur/slurm/details/constants';

import { getEChartOptions } from './utils';

const usages = require('./fixtures/usages.json');
const userUsages = require('./fixtures/user-usages.json');
const chartSpec = require('./fixtures/chart-spec.json');
const eChartOption = require('./fixtures/echart-option.json');

jest.mock('moment-timezone', () => {
  return () => jest.requireActual('moment')('2020-07-01T00:00:00.000Z');
});

describe('SLURM allocation usage chart formatter', () => {
  it('parses data and returns eChart option correctly', () => {
    expect(getEChartOptions(chartSpec, usages, userUsages)).toEqual({
      ...eChartOption,
      color: palette,
    });
  });
});

Fix unit tests by mocking momentjs.
Fix unit tests by mocking momentjs.
