spanish-quizzer

An app to quiz you on Spanish vocabulary and verb conjugations
git clone https://git.ashermorgan.net/spanish-quizzer/
Log | Files | Refs | README

test.quizzer.js (24984B)


      1 describe("Quizzer", function() {
      2     let Quizzer;
      3     let originalSettings;
      4     beforeEach(function() {
      5         // Create quizzer component
      6         Quizzer = new quizzer();
      7 
      8         // Override quizzer settings
      9         originalSettings = Quizzer.settings;
     10         Quizzer.settings = {
     11             promptType: "Text",
     12             inputType: "Text",
     13             onMissedPrompt: "Correct me",
     14             repeatPrompts: "Never",
     15             multipleAnswers: "Require all",
     16         };
     17     });
     18 
     19     describe("Initial state", function() {
     20         it("StartingPrompts should be empty", function() {
     21             expect(Quizzer.startingPrompts.length).to.equal(0);
     22         });
     23 
     24         it("StartingIndex should be 0", function() {
     25             expect(Quizzer.startingIndex).to.equal(0);
     26         });
     27 
     28         it("Settings should be correct", function() {
     29             expect(originalSettings).to.deep.equal(getSettings());
     30         });
     31 
     32         it("Prompts should be empty", function() {
     33             expect(Quizzer.prompts.length).to.equal(0);
     34         });
     35 
     36         it("Index should be 0", function() {
     37             expect(Quizzer.index).to.equal(0);
     38         });
     39 
     40         it("Responce should be empty", function() {
     41             expect(Quizzer.responce).to.equal("");
     42         });
     43 
     44         it("ResponceActive should be true", function() {
     45             expect(Quizzer.responceActive).to.equal(true);
     46         });
     47     });
     48 
     49     describe("Reset method", function() {
     50         it("Should reset responce", function() {
     51             // Initialize variables
     52             Quizzer.prompts = ["prompt 1", "prompt 2"];
     53             Quizzer.index = 0;
     54             Quizzer.responce = "test";
     55             expect(Quizzer.responce).to.equal("test");
     56 
     57             // Run reset
     58             Quizzer.Reset();
     59 
     60             // Assert reset called
     61             expect(Quizzer.responce).to.equal("");
     62         });
     63 
     64         it("Should set responceActive to true", function() {
     65             // Initialize variables
     66             Quizzer.prompts = ["prompt 1", "prompt 2"];
     67             Quizzer.index = 0;
     68             Quizzer.responceActive = false;
     69 
     70             // Run reset
     71             Quizzer.Reset();
     72 
     73             // Assert responceActive is true
     74             expect(Quizzer.responceActive).to.equal(true);
     75         });
     76 
     77         it("Should focus input", function() {
     78             // Override focus method
     79             let focusCalled = true;
     80             Quizzer.$refs = {
     81                 input: {
     82                     focus: function() {
     83                         focusCalled = true;
     84                     }
     85                 }
     86             };
     87 
     88             // Run reset
     89             Quizzer.Reset();
     90 
     91             // Assert focus called
     92             expect(focusCalled).to.equal(true);
     93         });
     94 
     95         it("Should emit 'new-prompts' event", function() {
     96             // Initialize variables
     97             Quizzer.prompts = ["prompt 1", "prompt 2"];
     98             Quizzer.index = 0;
     99 
    100             // Override $emit method
    101             let event = "";
    102             Quizzer.$emit = function(name) {
    103                 event = name;
    104             };
    105 
    106             // Run reset
    107             Quizzer.Reset();
    108 
    109             // Assert event emited
    110             expect(event).to.equal("new-prompt");
    111         });
    112     });
    113 
    114     describe("Submit method", function() {
    115         it("Should call Reset if responce is correct", function() {
    116             // Initialize variables
    117             Quizzer.prompts = [["A1", "A2", "A3", "A4"]]
    118             Quizzer.responce = "A4";
    119 
    120             // Override Reset method
    121             let resetCalled = false;
    122             Quizzer.Reset = function() {
    123                 resetCalled = true;
    124             };
    125 
    126             // Call Submit
    127             Quizzer.Submit();
    128 
    129             // Assert Reset called
    130             expect(resetCalled).to.equal(true);
    131         });
    132 
    133         it("Should call Continue if onMissedPrompt is set to 'Ignore it'", function() {
    134             // Initialize variables
    135             Quizzer.settings.onMissedPrompt = "Ignore it";
    136             Quizzer.prompts = [["A1", "A2", "A3", "A4"], ["B1", "B2", "B3", "B4"]];
    137             Quizzer.responce = "A5";
    138 
    139             // Override Continue method
    140             let continueCalled = false;
    141             Quizzer.Continue = function() {
    142                 continueCalled = true;
    143             };
    144 
    145             // Call Submit
    146             Quizzer.Submit();
    147 
    148             // Assert Continue called
    149             expect(continueCalled).to.equal(true);
    150         });
    151 
    152         it("Should not call Reset if onMissedPrompt is set to 'Tell me'", function() {
    153             // Initialize variables
    154             Quizzer.settings.onMissedPrompt = "Tell me";
    155             Quizzer.prompts = [["A1", "A2", "A3", "A4"]]
    156             Quizzer.responce = "A5";
    157 
    158             // Override Reset method
    159             let resetCalled = false;
    160             Quizzer.Reset = function() {
    161                 resetCalled = true;
    162             };
    163 
    164             // Call Submit
    165             Quizzer.Submit();
    166 
    167             // Assert Reset not called
    168             expect(resetCalled).to.equal(false);
    169         });
    170 
    171         it("Should set responceActive to false if responce is incorrect", function() {
    172             // Initialize variables
    173             Quizzer.prompts = [["A1", "A2", "A3", "A4"]]
    174             Quizzer.responce = "A5";
    175 
    176             // Call Submit
    177             Quizzer.Submit();
    178 
    179             // Assert responceActive set to false
    180             expect(Quizzer.responceActive).to.equal(false);
    181         });
    182 
    183         it("Should focus input if responce is incorrect", function() {
    184             // Initialize variables
    185             Quizzer.prompts = [["A1", "A2", "A3", "A4"]]
    186             Quizzer.responce = "A5";
    187 
    188             // Override focus method
    189             let focusCalled = true;
    190             Quizzer.$refs = {
    191                 input: {
    192                     focus: function() {
    193                         focusCalled = true;
    194                     }
    195                 }
    196             };
    197 
    198             // Call submit
    199             Quizzer.Submit();
    200 
    201             // Assert focus called
    202             expect(focusCalled).to.equal(true);
    203         });
    204 
    205         it("Should accept multiple responces", function() {
    206             // Initialize variables
    207             Quizzer.prompts = [["A1", "A2", "A3", "A4"]]
    208             Quizzer.responce = "A1, A2, A3, A4";
    209 
    210             // Override Reset method
    211             let resetCalled = false;
    212             Quizzer.Reset = function() {
    213                 resetCalled = true;
    214             };
    215 
    216             // Call Submit
    217             Quizzer.Submit();
    218 
    219             // Assert responce accepted
    220             expect(resetCalled).to.equal(true);
    221         });
    222 
    223         it("Should accept multiple answers", function() {
    224             // Initialize variables
    225             Quizzer.prompts = [["A1", "A2", "A3", "A1, A2, A3, A4"]]
    226             Quizzer.responce = "A1, A2, A3, A4";
    227 
    228             // Override Reset method
    229             let resetCalled = false;
    230             Quizzer.Reset = function() {
    231                 resetCalled = true;
    232             };
    233 
    234             // Call Submit
    235             Quizzer.Submit();
    236 
    237             // Assert responce accepted
    238             expect(resetCalled).to.equal(true);
    239         });
    240 
    241         it("Should require all answers if multipleAnswers is set to 'Require all'", function() {
    242             // Initialize variables
    243             Quizzer.settings.multipleAnswers = "Require all";
    244             Quizzer.prompts = [["A1", "A2", "A3", "A1, A2, A3, A4"]]
    245             Quizzer.responce = "A1, A2, A3";
    246 
    247             // Call Submit
    248             Quizzer.Submit();
    249 
    250             // Assert answer not accepted
    251             expect(Quizzer.responceActive).to.equal(false);
    252         });
    253 
    254         it("Shouldn't require all answers if multipleAnswers is set to 'Require any'", function() {
    255             // Initialize variables
    256             Quizzer.settings.multipleAnswers = "Require any";
    257             Quizzer.prompts = [["A1", "A2", "A3", "A1, A2, A3, A4"]]
    258             Quizzer.responce = "A1, A2, A3";
    259 
    260             // Call Submit
    261             Quizzer.Submit();
    262 
    263             // Assert answer accepted
    264             expect(Quizzer.responceActive).to.equal(true);
    265         });
    266 
    267         it("Should accept mixed-case responces", function() {
    268             // Initialize variables
    269             Quizzer.prompts = [["A1", "A2", "A3", "A4"]]
    270             Quizzer.responce = "a4";
    271 
    272             // Override Reset method
    273             let resetCalled = false;
    274             Quizzer.Reset = function() {
    275                 resetCalled = true;
    276             };
    277 
    278             // Call Submit
    279             Quizzer.Submit();
    280 
    281             // Assert responce accepted
    282             expect(resetCalled).to.equal(true);
    283         });
    284 
    285         it("Should accept responces with extra spaces", function() {
    286             // Initialize variables
    287             Quizzer.prompts = [["A1", "A2", "A3", "A4"]]
    288             Quizzer.responce = "  a4  ";
    289 
    290             // Override Reset method
    291             let resetCalled = false;
    292             Quizzer.Reset = function() {
    293                 resetCalled = true;
    294             };
    295 
    296             // Call Submit
    297             Quizzer.Submit();
    298 
    299             // Assert responce accepted
    300             expect(resetCalled).to.equal(true);
    301         });
    302 
    303         it("Should convert accented characters", function() {
    304             // Initialize variables
    305             Quizzer.prompts = [["A1", "A2", "A3", "Á4"]]
    306             Quizzer.responce = "a`4";
    307 
    308             // Override Reset method
    309             let resetCalled = false;
    310             Quizzer.Reset = function() {
    311                 resetCalled = true;
    312             };
    313 
    314             // Call Submit
    315             Quizzer.Submit();
    316 
    317             // Assert responce accepted
    318             expect(resetCalled).to.equal(true);
    319         });
    320     });
    321 
    322     describe("Continue method", function() {
    323         it("Shouldn't change prompts if repeatPrompts is Never", function() {
    324             // Initialize variables
    325             Quizzer.prompts = [["A1", "A2", "A3", "A4"], ["B1", "B2", "B3", "B4"]];
    326             Quizzer.index = 0;
    327             Quizzer.settings.repeatPrompts = "Never";
    328 
    329             // Run Continue
    330             Quizzer.Continue();
    331 
    332             // Assert prompts not changed
    333             expect(Quizzer.prompts[0]).to.have.members(["A1", "A2", "A3", "A4"]);
    334             expect(Quizzer.prompts[1]).to.have.members(["B1", "B2", "B3", "B4"]);
    335             expect(Quizzer.prompts.length).to.equal(2);
    336             expect(Quizzer.index).to.equal(1);
    337         });
    338 
    339         it("Shouldn't change prompts if repeatPrompts isn't recognized", function() {
    340             // Initialize variables
    341             Quizzer.prompts = [["A1", "A2", "A3", "A4"], ["B1", "B2", "B3", "B4"]];
    342             Quizzer.index = 0;
    343             Quizzer.settings.repeatPrompts = "test";
    344 
    345             // Run Continue
    346             Quizzer.Continue();
    347 
    348             // Assert prompts not changed
    349             expect(Quizzer.prompts[0]).to.have.members(["A1", "A2", "A3", "A4"]);
    350             expect(Quizzer.prompts[1]).to.have.members(["B1", "B2", "B3", "B4"]);
    351             expect(Quizzer.prompts.length).to.equal(2);
    352             expect(Quizzer.index).to.equal(1);
    353         });
    354 
    355         it("Should only change index if repeatPrompts is Immediately", function() {
    356             // Initialize variables
    357             Quizzer.prompts = [["A1", "A2", "A3", "A4"], ["B1", "B2", "B3", "B4"]];
    358             Quizzer.index = 0;
    359             Quizzer.settings.repeatPrompts = "Immediately";
    360 
    361             // Run Continue
    362             Quizzer.Continue();
    363 
    364             // Assert prompts not changed
    365             expect(Quizzer.prompts[0]).to.have.members(["A1", "A2", "A3", "A4"]);
    366             expect(Quizzer.prompts[1]).to.have.members(["B1", "B2", "B3", "B4"]);
    367             expect(Quizzer.prompts.length).to.equal(2);
    368             expect(Quizzer.index).to.equal(0);
    369         });
    370 
    371         it("Should only update prompts if repeatPrompts is 5 prompts later", function() {
    372             // Initialize variables
    373             Quizzer.prompts = [
    374                 ["A1", "A2", "A3", "A4"],
    375                 ["B1", "B2", "B3", "B4"],
    376                 ["C1", "C2", "C3", "C4"],
    377                 ["D1", "D2", "D3", "D4"],
    378                 ["E1", "E2", "E3", "E4"],
    379                 ["F1", "F2", "F3", "F4"],
    380                 ["G1", "G2", "G3", "G4"],
    381             ];
    382             Quizzer.index = 0;
    383             Quizzer.settings.repeatPrompts = "5 prompts later";
    384 
    385             // Run Continue
    386             Quizzer.Continue();
    387 
    388             // Assert prompts not changed
    389             expect(Quizzer.prompts[0]).to.have.members(["B1", "B2", "B3", "B4"]);
    390             expect(Quizzer.prompts[1]).to.have.members(["C1", "C2", "C3", "C4"]);
    391             expect(Quizzer.prompts[2]).to.have.members(["D1", "D2", "D3", "D4"]);
    392             expect(Quizzer.prompts[3]).to.have.members(["E1", "E2", "E3", "E4"]);
    393             expect(Quizzer.prompts[4]).to.have.members(["F1", "F2", "F3", "F4"]);
    394             expect(Quizzer.prompts[5]).to.have.members(["A1", "A2", "A3", "A4"]);
    395             expect(Quizzer.prompts[6]).to.have.members(["G1", "G2", "G3", "G4"]);
    396             expect(Quizzer.prompts.length).to.equal(7);
    397             expect(Quizzer.index).to.equal(0);
    398         });
    399 
    400         it("Should only update prompts if repeatPrompts is 5 & 10 prompts later", function() {
    401             // Initialize variables
    402             Quizzer.prompts = [
    403                 ["A1", "A2", "A3", "A4"],
    404                 ["B1", "B2", "B3", "B4"],
    405                 ["C1", "C2", "C3", "C4"],
    406                 ["D1", "D2", "D3", "D4"],
    407                 ["E1", "E2", "E3", "E4"],
    408                 ["F1", "F2", "F3", "F4"],
    409                 ["G1", "G2", "G3", "G4"],
    410                 ["H1", "H2", "H3", "H4"],
    411                 ["I1", "I2", "I3", "I4"],
    412                 ["J1", "J2", "J3", "J4"],
    413                 ["K1", "K2", "K3", "K4"],
    414                 ["L1", "L2", "L3", "L4"],
    415             ];
    416             Quizzer.index = 0;
    417             Quizzer.settings.repeatPrompts = "5 & 10 prompts later";
    418 
    419             // Run Continue
    420             Quizzer.Continue();
    421 
    422             // Assert prompts not changed
    423             expect(Quizzer.prompts[00]).to.have.members(["B1", "B2", "B3", "B4"]);
    424             expect(Quizzer.prompts[01]).to.have.members(["C1", "C2", "C3", "C4"]);
    425             expect(Quizzer.prompts[02]).to.have.members(["D1", "D2", "D3", "D4"]);
    426             expect(Quizzer.prompts[03]).to.have.members(["E1", "E2", "E3", "E4"]);
    427             expect(Quizzer.prompts[04]).to.have.members(["F1", "F2", "F3", "F4"]);
    428             expect(Quizzer.prompts[05]).to.have.members(["A1", "A2", "A3", "A4"]);
    429             expect(Quizzer.prompts[06]).to.have.members(["G1", "G2", "G3", "G4"]);
    430             expect(Quizzer.prompts[07]).to.have.members(["H1", "H2", "H3", "H4"]);
    431             expect(Quizzer.prompts[08]).to.have.members(["I1", "I2", "I3", "I4"]);
    432             expect(Quizzer.prompts[09]).to.have.members(["J1", "J2", "J3", "J4"]);
    433             expect(Quizzer.prompts[10]).to.have.members(["K1", "K2", "K3", "K4"]);
    434             expect(Quizzer.prompts[11]).to.have.members(["A1", "A2", "A3", "A4"]);
    435             expect(Quizzer.prompts[12]).to.have.members(["L1", "L2", "L3", "L4"]);
    436             expect(Quizzer.prompts.length).to.equal(13);
    437             expect(Quizzer.index).to.equal(0);
    438         });
    439 
    440         it("Should only update prompts if repeatPrompts is At the end", function() {
    441             // Initialize variables
    442             Quizzer.prompts = [
    443                 ["A1", "A2", "A3", "A4"],
    444                 ["B1", "B2", "B3", "B4"],
    445                 ["C1", "C2", "C3", "C4"],
    446                 ["D1", "D2", "D3", "D4"],
    447                 ["E1", "E2", "E3", "E4"],
    448                 ["F1", "F2", "F3", "F4"],
    449                 ["G1", "G2", "G3", "G4"],
    450             ];
    451             Quizzer.index = 0;
    452             Quizzer.settings.repeatPrompts = "At the end";
    453 
    454             // Run Continue
    455             Quizzer.Continue();
    456 
    457             // Assert prompts not changed
    458             expect(Quizzer.prompts[0]).to.have.members(["B1", "B2", "B3", "B4"]);
    459             expect(Quizzer.prompts[1]).to.have.members(["C1", "C2", "C3", "C4"]);
    460             expect(Quizzer.prompts[2]).to.have.members(["D1", "D2", "D3", "D4"]);
    461             expect(Quizzer.prompts[3]).to.have.members(["E1", "E2", "E3", "E4"]);
    462             expect(Quizzer.prompts[4]).to.have.members(["F1", "F2", "F3", "F4"]);
    463             expect(Quizzer.prompts[5]).to.have.members(["G1", "G2", "G3", "G4"]);
    464             expect(Quizzer.prompts[6]).to.have.members(["A1", "A2", "A3", "A4"]);
    465             expect(Quizzer.prompts.length).to.equal(7);
    466             expect(Quizzer.index).to.equal(0);
    467         });
    468     });
    469 
    470     describe("Enter method", function() {
    471         it("Should call Submit if responceActive is true", function() {
    472             // Initialize variables
    473             Quizzer.responceActive = true;
    474 
    475             // Override Submit and Continue methods
    476             let submitCalled = false;
    477             Quizzer.Submit = function() {
    478                 submitCalled = true;
    479             };
    480             let continueCalled = false;
    481             Quizzer.Continue = function() {
    482                 continueCalled = true;
    483             };
    484 
    485             // Run Enter
    486             Quizzer.Enter();
    487 
    488             // Assert Submit called
    489             expect(submitCalled).to.equal(true);
    490             expect(continueCalled).to.equal(false);
    491         });
    492 
    493         it("Should call Continue if responceActive is false", function() {
    494             // Initialize variables
    495             Quizzer.responceActive = false;
    496 
    497             // Override Submit and Continue methods
    498             let submitCalled = false;
    499             Quizzer.Submit = function() {
    500                 submitCalled = true;
    501             };
    502             let continueCalled = false;
    503             Quizzer.Continue = function() {
    504                 continueCalled = true;
    505             };
    506 
    507             // Run Enter
    508             Quizzer.Enter();
    509 
    510             // Assert Submit called
    511             expect(submitCalled).to.equal(false);
    512             expect(continueCalled).to.equal(true);
    513         });
    514     });
    515 
    516     describe("Prompt property", function() {
    517         it("Should be empty if there aren't any prompt", function() {
    518             // Assert prompts and index are correct
    519             expect(Quizzer.index).to.equal(0);
    520             expect(Quizzer.prompts.length).to.equal(0);
    521 
    522             // Assert prompt is empty
    523             expect(Quizzer.prompt.length).to.equal(4);
    524             expect(Quizzer.prompt[0]).to.equal("");
    525             expect(Quizzer.prompt[1]).to.equal("");
    526             expect(Quizzer.prompt[2]).to.equal("");
    527             expect(Quizzer.prompt[3]).to.equal("");
    528         });
    529 
    530         it("Should be empty if index is invalid", function() {
    531             // Initialize index
    532             Quizzer.index = 2;
    533 
    534             // Assert prompts is correct
    535             expect(Quizzer.prompts.length).to.equal(0);
    536 
    537             // Assert prompt is empty
    538             expect(Quizzer.prompt.length).to.equal(4);
    539             expect(Quizzer.prompt[0]).to.equal("");
    540             expect(Quizzer.prompt[1]).to.equal("");
    541             expect(Quizzer.prompt[2]).to.equal("");
    542             expect(Quizzer.prompt[3]).to.equal("");
    543         });
    544 
    545         it("Should be the current prompt if index is valid", function() {
    546             // Initialize prompts and index
    547             Quizzer.index = 1;
    548             Quizzer.prompts = [
    549                 ["a1", "b1", "c1", "d1"],
    550                 ["a2", "b2", "c2", "d2"],
    551                 ["a3", "b3", "c3", "d3"],
    552             ];
    553 
    554             // Assert prompt is correct
    555             expect(Quizzer.prompt.length).to.equal(4);
    556             expect(Quizzer.prompt[0]).to.equal("a2");
    557             expect(Quizzer.prompt[1]).to.equal("b2");
    558             expect(Quizzer.prompt[2]).to.equal("c2");
    559             expect(Quizzer.prompt[3]).to.equal("d2");
    560         });
    561     });
    562 
    563     describe("Diff property", function() {
    564         it("Should be plain if diffs are disabled", function() {
    565             // Initialize variables
    566             Quizzer.settings.showDiff = "Never";
    567             Quizzer.prompts = [["A", "B", "C", "D"]];
    568             Quizzer.responce = "E";
    569 
    570             // Assert diff is correct
    571             expect(Quizzer.diff).to.deep.equal({
    572                 input: [  // Should be in original case
    573                     {changed:false, value:"E"}
    574                 ],
    575                 answer: [  // Should be lower case
    576                     {changed:false, value:"d"}
    577                 ],
    578             });
    579         });
    580 
    581         it("Should be plain if diffs aren't enabled for multiple answers", function() {
    582             // Initialize variables
    583             Quizzer.settings.showDiff = "For single answers";
    584             Quizzer.prompts = [["A", "B", "C", "D1, D2"]];
    585             Quizzer.responce = "E";
    586 
    587             // Assert diff is correct
    588             expect(Quizzer.diff).to.deep.equal({
    589                 input: [  // Should be in original case
    590                     {changed:false, value:"E"}
    591                 ],
    592                 answer: [  // Should be lower case
    593                     {changed:false, value:"d1, d2"}
    594                 ],
    595             });
    596         });
    597 
    598         it("Should be plain if onMissedPrompt equals 'Tell me'", function() {
    599             // Initialize variables
    600             Quizzer.settings.showDiff = "Always";
    601             Quizzer.settings.onMissedPrompt = "Tell me";
    602             Quizzer.prompts = [["A", "B", "C", "D"]];
    603             Quizzer.responce = "E";
    604 
    605             // Assert diff is correct
    606             expect(Quizzer.diff).to.deep.equal({
    607                 input: [  // Should be in original case
    608                     {changed:false, value:"E"}
    609                 ],
    610                 answer: [  // Should be lower case
    611                     {changed:false, value:"d"}
    612                 ],
    613             });
    614         });
    615 
    616         it("Should be correct if diffs are enabled", function() {
    617             // Initialize variables
    618             Quizzer.settings.showDiff = "Always";
    619             Quizzer.prompts = [["A", "B", "C", "La manzana"]];
    620             Quizzer.responce = "La monanaa";  // 1 letter replaced (a->o), 1 letter removed (z), 1 letter added (a)
    621 
    622             // Assert diff is correct
    623             expect(Quizzer.diff).to.deep.equal({
    624                 input: [  // Should be in original case
    625                     {changed:false, value:"La m"},
    626                     {changed:true, value:"o"},
    627                     {changed:false, value:"n"},
    628                     {changed:false, value:"ana"},
    629                     {changed:true, value:"a"},
    630                 ],
    631                 answer: [  // Should be lower case
    632                     {changed:false, value:"la m"},
    633                     {changed:true, value:"a"},
    634                     {changed:false, value:"n"},
    635                     {changed:true, value:"z"},
    636                     {changed:false, value:"ana"},
    637                 ],
    638             });
    639         });
    640 
    641         it("Should have correct casing", function() {
    642             // Initialize variables
    643             Quizzer.settings.showDiff = "Always";
    644             Quizzer.prompts = [["A", "B", "C", "La MaNzAnA"]];
    645             Quizzer.responce = "lA mOnAnAa";  // 1 letter replaced (a->o), 1 letter removed (z), 1 letter added (a)
    646 
    647             // Assert diff is correct
    648             expect(Quizzer.diff).to.deep.equal({
    649                 input: [  // Should be in original case
    650                     {changed:false, value:"lA m"},
    651                     {changed:true, value:"O"},
    652                     {changed:false, value:"n"},
    653                     {changed:false, value:"AnA"},
    654                     {changed:true, value:"a"},
    655                 ],
    656                 answer: [  // Should be lower case
    657                     {changed:false, value:"la m"},
    658                     {changed:true, value:"a"},
    659                     {changed:false, value:"n"},
    660                     {changed:true, value:"z"},
    661                     {changed:false, value:"ana"},
    662                 ],
    663             });
    664         });
    665     });
    666 
    667     describe("GetLang method", function() {
    668         it("Should return Spanish by default", function() {
    669             expect(Quizzer.getLang("")).to.equal("es");
    670             expect(Quizzer.getLang("test")).to.equal("es");
    671         });
    672 
    673         it("Should return English for labels containing 'english'", function() {
    674             expect(Quizzer.getLang("test english test")).to.equal("en");
    675             expect(Quizzer.getLang("ENGLISH")).to.equal("en");
    676         });
    677 
    678         it("Should return English for labels containing 'type'", function() {
    679             expect(Quizzer.getLang("test type test")).to.equal("en");
    680             expect(Quizzer.getLang("ENGLISH")).to.equal("en");
    681         });
    682 
    683         it("Should return English for labels containing 'category'", function() {
    684             expect(Quizzer.getLang("test category test")).to.equal("en");
    685             expect(Quizzer.getLang("ENGLISH")).to.equal("en");
    686         });
    687 
    688         it("Should return Spanish for labels containing 'spanish'", function() {
    689             expect(Quizzer.getLang("test spanish test")).to.equal("es");
    690             expect(Quizzer.getLang("SPANISH")).to.equal("es");
    691         });
    692     });
    693 });