<commit_before>'use strict';

var _ = require('lodash');
var should = require('should');
var levels = require('../lib/levels');

describe('settings', function ( ) {
  var settings = require('../lib/settings')();

  it('have defaults ready', function () {
    settings.timeFormat.should.equal(12);
    settings.nightMode.should.equal(false);
    settings.showRawbg.should.equal('never');
    settings.customTitle.should.equal('Nightscout');
    settings.theme.should.equal('default');
    settings.alarmUrgentHigh.should.equal(true);
    settings.alarmUrgentHighMins.should.eql([30, 60, 90, 120]);
    settings.alarmHigh.should.equal(true);
    settings.alarmHighMins.should.eql([30, 60, 90, 120]);
    settings.alarmLow.should.equal(true);
    settings.alarmLowMins.should.eql([15, 30, 45, 60]);
    settings.alarmUrgentLow.should.equal(true);
    settings.alarmUrgentLowMins.should.eql([15, 30, 45]);
    settings.alarmUrgentMins.should.eql([30, 60, 90, 120]);
    settings.alarmWarnMins.should.eql([30, 60, 90, 120]);
    settings.alarmTimeagoWarn.should.equal(true);
    settings.alarmTimeagoWarnMins.should.equal(15);
    settings.alarmTimeagoUrgent.should.equal(true);
    settings.alarmTimeagoUrgentMins.should.equal(30);
    settings.language.should.equal('en');
    settings.showPlugins.should.equal('');
    settings.insecureUseHttp.should.equal(false);
    settings.secureHstsHeader.should.equal(true);
    settings.secureCsp.should.equal(true);
  });

  it('support setting from env vars', function () {
    var expected = [
      'ENABLE'
      , 'DISABLE'
      , 'UNITS'
      , 'TIME_FORMAT'
      , 'NIGHT_MODE'
      , 'SHOW_RAWBG'
      , 'CUSTOM_TITLE'
      , 'THEME'
      , 'ALARM_TYPES'
      , 'ALARM_URGENT_HIGH'
      , 'ALARM_HIGH'
      , 'ALARM_LOW'
      , 'ALARM_URGENT_LOW'<commit_msg>fix settings.test.js<commit_after>'use strict';

var _ = require('lodash');
var should = require('should');
var levels = require('../lib/levels');

describe('settings', function ( ) {
  var settings = require('../lib/settings')();

  it('have defaults ready', function () {
    settings.timeFormat.should.equal(12);
    settings.nightMode.should.equal(false);
    settings.showRawbg.should.equal('never');
    settings.customTitle.should.equal('Nightscout');
    settings.theme.should.equal('default');
    settings.alarmUrgentHigh.should.equal(true);
    settings.alarmUrgentHighMins.should.eql([30, 60, 90, 120]);
    settings.alarmHigh.should.equal(true);
    settings.alarmHighMins.should.eql([30, 60, 90, 120]);
    settings.alarmLow.should.equal(true);
    settings.alarmLowMins.should.eql([15, 30, 45, 60]);
    settings.alarmUrgentLow.should.equal(true);
    settings.alarmUrgentLowMins.should.eql([15, 30, 45]);
    settings.alarmUrgentMins.should.eql([30, 60, 90, 120]);
    settings.alarmWarnMins.should.eql([30, 60, 90, 120]);
    settings.alarmTimeagoWarn.should.equal(true);
    settings.alarmTimeagoWarnMins.should.equal(15);
    settings.alarmTimeagoUrgent.should.equal(true);
    settings.alarmTimeagoUrgentMins.should.equal(30);
    settings.language.should.equal('en');
    settings.showPlugins.should.equal('');
    settings.insecureUseHttp.should.equal(false);
    settings.secureHstsHeader.should.equal(true);
    settings.secureCsp.should.equal(false);
  });

  it('support setting from env vars', function () {
    var expected = [
      'ENABLE'
      , 'DISABLE'
      , 'UNITS'
      , 'TIME_FORMAT'
      , 'NIGHT_MODE'
      , 'SHOW_RAWBG'
      , 'CUSTOM_TITLE'
      , 'THEME'
      , 'ALARM_TYPES'
      , 'ALARM_URGENT_HIGH'
      , 'ALARM_HIGH'
      , 'ALARM_LOW'
      , 'ALARM_URGENT_LOW'
{'fraction_non_alphanumeric': 0.15815485996705106, 'fraction_numerical': 0.030752333882482153, 'mean_word_length': 3.8060686015831133, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7113213', 'n_tokens_mistral': 1370, 'n_tokens_neox': 1259, 'n_words': 162}