/**
 * Created by thorsten on 3/24/17.
 */

const preferencesArray = [{
        key: 'runDetails.logView',
        defaultValue: 'pipeline',
        allowedValues: ['classic', 'pipeline'],
    },
    {
        key: 'runDetails.pipeline.updateOnFinish',
        defaultValue: 'default',
        allowedValues: ['default', 'never'],
    },
    {
        key: 'runDetails.pipeline.showPending',
        defaultValue: 'default',
        allowedValues: ['default', 'never'],
    },
    {
        key: 'runDetails.pipeline.karaoke',
        defaultValue: 'default',
        allowedValues: ['default', 'never'],
    },
];

describe("Preference smoke testing", function () {
    const preference = require('../preferences/Preference');
    it("returns undefined", function () {
        const prop = preference.newPreference('xxx');
        expect(prop.value).toBe(undefined);
    })
    it("returns defaultValue", function () {
        const prop = preference.newPreference('xxx', 'aaa');
        expect(prop.value).toBe('aaa');
    })
    it("returns allowedValues", function () {
        const prop = preference.newPreference('xxx2', 'xxx', ['aaa', 'xxx']);
        expect(prop.value).toBe('xxx');
        expect(prop.getAllowedValues()).toEqual(['aaa', 'xxx']);
    })
});

describe("Preferences smoke testing", function () {
    const preferences = require('../preferences/Preferences');
    const karaokeConfig = preferences.newPreferences(preferencesArray);
    it("returns undefined", function () {
        const prop = karaokeConfig.getPreference('xxx');
        expect(prop).toBe(undefined);
    })
    it("returns defaultValue and allowedValues", function () {
        const prop = karaokeConfig.getPreference('runDetails.logView');
        expect(prop.value).toBe('pipeline');
        expect(prop.getAllowedValues()).toEqual(['classic', 'pipeline']);
    })
});

@@ -859,33 +859,34 @@
 defined);%0A    %7D)
+;
 %0A
-
     it(%22returns 
@@ -1013,32 +1013,33 @@
 e('aaa');%0A    %7D)
+;
 %0A    it(%22returns
@@ -1254,24 +1254,25 @@
 x'%5D);%0A    %7D)
+;
 %0A%7D);%0A%0Adescri
@@ -1595,16 +1595,17 @@
 ;%0A    %7D)
+;
 %0A    it(
@@ -1629,26 +1629,8 @@
 alue
- and allowedValues
 %22, f
@@ -1755,24 +1755,224 @@
 pipeline');%0A
+    %7D);%0A    it(%22returns defaultValue and allowedValues%22, function () %7B%0A        const prop = karaokeConfig.getPreference('runDetails.pipeline.showPending');%0A        expect(prop.value).toBe('default');%0A
         expe
@@ -2009,35 +2009,32 @@
 Equal(%5B'
-classic', 'pipeline
+default', 'never
 '%5D);%0A   
@@ -2036,13 +2036,14 @@
 ;%0A    %7D)
+;
 %0A%7D);%0A

add smoke testing to validate basic functionality