diff --git a/spec/javascripts/bridge-spec.js b/spec/javascripts/bridge-spec.js index 838daf3b5..37e4cfacd 100644 --- a/spec/javascripts/bridge-spec.js +++ b/spec/javascripts/bridge-spec.js @@ -1,5 +1,5 @@ describe('bridge', () => { it('can create bridge', () => { expect(new mumuki.bridge.Laboratory()).not.toBe(null); - }) -}) + }); +}); diff --git a/spec/javascripts/csrf-token-spec.js b/spec/javascripts/csrf-token-spec.js index 5b9265a30..9e719a3a2 100644 --- a/spec/javascripts/csrf-token-spec.js +++ b/spec/javascripts/csrf-token-spec.js @@ -1,7 +1,7 @@ describe('csrf token', () => { it('can create token', () => { expect(new mumuki.CsrfToken()).not.toBe(null); - }) -}) + }); +}); diff --git a/spec/javascripts/editors-spec.js b/spec/javascripts/editors-spec.js index 267a15ac1..8010accb6 100644 --- a/spec/javascripts/editors-spec.js +++ b/spec/javascripts/editors-spec.js @@ -1,11 +1,10 @@ describe('editors', () => { - beforeEach(() => { - mumuki.CustomEditor.clearSources() - }) + mumuki.CustomEditor.clearSources(); + }); it('has initially no sources', () => { - expect(mumuki.CustomEditor.hasSources).toBe(false) + expect(mumuki.CustomEditor.hasSources).toBe(false); }); it('can add a custom source', () => { @@ -26,7 +25,7 @@ describe('editors', () => {
- `) + `); mumuki.editors.addCustomSource({ getContent() { @@ -43,11 +42,10 @@ describe('editors', () => {
- `) + `); expect(mumuki.editors.getSubmission()).toEqual({"solution[content]":"the solution"}); }); - it('reads the form if no sources and exercise is multifile', () => { $('body').html(`
@@ -63,7 +61,7 @@ describe('editors', () => { name="solution[content[receta.css]]" id="solution_content[receta.css]">some css -
`) + `); expect(mumuki.editors.getSubmission()).toEqual({ "solution[content[index.html]]": "some html", "solution[content[receta.css]]": "some css" @@ -74,4 +72,4 @@ describe('editors', () => { $('body').html(``); expect(mumuki.editors.getSubmission()).toEqual({}); }); -}) +}); diff --git a/spec/javascripts/elipsis-spec.js b/spec/javascripts/elipsis-spec.js index 9b72aff3b..76fdd7ee7 100644 --- a/spec/javascripts/elipsis-spec.js +++ b/spec/javascripts/elipsis-spec.js @@ -1,7 +1,7 @@ describe('elipsis', () => { it('does nothing when no elipsis', () => { expect(mumuki.elipsis('hello')).toEqual('hello'); - }) + }); it('replaces student elipsis', () => { expect(mumuki.elipsis(`function longitud(unString) { @@ -10,7 +10,7 @@ describe('elipsis', () => { /*@elipsis-for-student>*/ }`)).toEqual(`function longitud(unString) { /* ... */ - }`) + }`); }); it('replaces student hidden', () => { @@ -20,6 +20,6 @@ describe('elipsis', () => { /*@hidden-for-student>*/ }`)).toEqual(`function longitud(unString) { /**/ - }`) + }`); }); -}) +}); diff --git a/spec/javascripts/events-spec.js b/spec/javascripts/events-spec.js index bac31054d..01871e062 100644 --- a/spec/javascripts/events-spec.js +++ b/spec/javascripts/events-spec.js @@ -6,18 +6,18 @@ describe('events', () => { it('is not called when it is not fired', () => { mumuki.events.on('foo', (e) => { fail(`should not be called, but got ${JSON.stringify(e)}`); - }) - }) + }); + }); it('is not called when it is fired but not enabled', () => { let fired = false; mumuki.events.on('foo', (e) => { fail(`should not be called, but got ${JSON.stringify(e)}`); fired = true; - }) + }); mumuki.events.fire('foo', 42); expect(fired).toBe(false); - }) + }); it('is called when it is fired and enabled', () => { let fired = false; @@ -25,9 +25,9 @@ describe('events', () => { mumuki.events.on('foo', (event) => { expect(event).toEqual(42); fired = true; - }) + }); mumuki.events.fire('foo', 42); expect(fired).toBe(true); - }) -}) + }); +}); diff --git a/spec/javascripts/exercise-spec.js b/spec/javascripts/exercise-spec.js index 929e19212..be2d02937 100644 --- a/spec/javascripts/exercise-spec.js +++ b/spec/javascripts/exercise-spec.js @@ -1,10 +1,9 @@ describe('exercise', () => { - it('current exercise information is available when present', () => { $('body').html(` - `) + `); mumuki.exercise.load(); @@ -12,13 +11,13 @@ describe('exercise', () => { expect(mumuki.exercise.layout).toBe('input_right'); expect(mumuki.exercise.settings).toEqual({}); expect(mumuki.exercise.current).not.toBe(null); - }) + }); it('current exercise information is available when present and settings are not empty', () => { $('body').html(` - `) + `); mumuki.exercise.load(); @@ -26,10 +25,10 @@ describe('exercise', () => { expect(mumuki.exercise.layout).toBe('input_right'); expect(mumuki.exercise.settings.game_framework).toBe(true); expect(mumuki.exercise.current).not.toBe(null); - }) + }); it('current exercise information is available when not present', () => { - $('body').html(``) + $('body').html(``); mumuki.exercise.load(); @@ -37,5 +36,5 @@ describe('exercise', () => { expect(mumuki.exercise.layout).toBe(null); expect(mumuki.exercise.settings).toBe(null); expect(mumuki.exercise.current).toBe(null); - }) -}) + }); +}); diff --git a/spec/javascripts/global-spec.js b/spec/javascripts/global-spec.js index f0bad7b83..0aac165d3 100644 --- a/spec/javascripts/global-spec.js +++ b/spec/javascripts/global-spec.js @@ -1,6 +1,6 @@ describe("global loading", () => { it("produces no global loading errors", () => { const error = window['__globalLoadingError__']; - expect(!error).toBe(true, `Expected no global loading errors but got ${error && error.message}`) - }) -}) + expect(!error).toBe(true, `Expected no global loading errors but got ${error && error.message}`); + }); +}); diff --git a/spec/javascripts/i18n-spec.js b/spec/javascripts/i18n-spec.js index 02926f7f2..6a5922d1a 100644 --- a/spec/javascripts/i18n-spec.js +++ b/spec/javascripts/i18n-spec.js @@ -1,29 +1,30 @@ describe('I18n', () => { - describe('t / translate', () => { - it('accept english translations', () => { mumuki.locale = 'en'; expect(mumuki.I18n.translate('passed')).toBe('Everything is in order! Your solution passed all our tests!'); - }) + }); + it('accept spanish translations', () => { mumuki.locale = 'es'; expect(mumuki.I18n.translate('passed_with_warnings')).toBe('Tu solución funcionó, pero hay cosas que mejorar'); - }) + }); + it('accept chilean translations', () => { mumuki.locale = 'es-CL'; expect(mumuki.I18n.translate('failed')).toBe('Tu solución no pasó las pruebas'); - }) + }); + it('accept portuguese translations', () => { mumuki.locale = 'pt'; expect(mumuki.I18n.translate('errored')).toBe('Opa! Sua solução não pode ser executada'); - }) + }); + it('fails when translation missing', () => { mumuki.locale = 'en'; expect(mumuki.I18n.translate('foo')).toBe('Translation missing: en, `foo`'); - }) - - }) + }); + }); describe('register', () => { beforeEach(() => { @@ -33,21 +34,23 @@ describe('I18n', () => { greet: (data) => `Hi ${data.name}`, errored: "D'Oh!" } - }) - }) + }); + }); + it('overrides existing translation key', () => { expect(mumuki.I18n.translate('errored')).toBe("D'Oh!"); - }) + }); + it('add missing translation key', () => { expect(mumuki.I18n.translate('greet', {name: 'Jane'})).toBe('Hi Jane'); - }) + }); + it('keep non overriding translation key', () => { expect(mumuki.I18n.translate('passed')).toBe('Everything is in order! Your solution passed all our tests!'); - }) - }) + }); + }); describe('with some prefix', () => { - fixture.set(`
`); - }) - -}) + }); +}); diff --git a/spec/javascripts/submissions-store-spec.js b/spec/javascripts/submissions-store-spec.js index cac925151..88d1a1dab 100644 --- a/spec/javascripts/submissions-store-spec.js +++ b/spec/javascripts/submissions-store-spec.js @@ -6,39 +6,39 @@ describe("SubmissionsStore", () => { const passedEmptyProgramSubmissionAndResult = { submission: emptyProgramSubmission, result: passedSubmissionResult }; beforeEach(() => { - window.localStorage.clear() + window.localStorage.clear(); }); describe('getLastSubmission', () => { it("answers null if submission not present", () => { - expect(mumuki.SubmissionsStore.getLastSubmissionAndResult(1)).toBe(null) + expect(mumuki.SubmissionsStore.getLastSubmissionAndResult(1)).toBe(null); }); it("answers the last submission result if already sent", () => { - mumuki.SubmissionsStore.setSubmissionResultFor(1, passedEmptyProgramSubmissionAndResult) - expect(mumuki.SubmissionsStore.getLastSubmissionAndResult(1)).toEqual(passedEmptyProgramSubmissionAndResult) + mumuki.SubmissionsStore.setSubmissionResultFor(1, passedEmptyProgramSubmissionAndResult); + expect(mumuki.SubmissionsStore.getLastSubmissionAndResult(1)).toEqual(passedEmptyProgramSubmissionAndResult); }); }); describe('getLastSubmissionStatus', () => { it("answers pending if submission not present", () => { - expect(mumuki.SubmissionsStore.getLastSubmissionStatus(1)).toBe('pending') + expect(mumuki.SubmissionsStore.getLastSubmissionStatus(1)).toBe('pending'); }); it("answers the last submission status if previously sent", () => { - mumuki.SubmissionsStore.setSubmissionResultFor(1, passedEmptyProgramSubmissionAndResult) - expect(mumuki.SubmissionsStore.getLastSubmissionStatus(1)).toBe('passed') + mumuki.SubmissionsStore.setSubmissionResultFor(1, passedEmptyProgramSubmissionAndResult); + expect(mumuki.SubmissionsStore.getLastSubmissionStatus(1)).toBe('passed'); }); }); describe('getCachedResultFor', () => { it("answers null if submission not present", () => { - expect(mumuki.SubmissionsStore.getSubmissionResultFor(1, emptyProgramSubmission)).toBe(null) + expect(mumuki.SubmissionsStore.getSubmissionResultFor(1, emptyProgramSubmission)).toBe(null); }); it("answers the last submission if previously sent", () => { - mumuki.SubmissionsStore.setSubmissionResultFor(1, passedEmptyProgramSubmissionAndResult) - expect(mumuki.SubmissionsStore.getSubmissionResultFor(1, emptyProgramSubmission)).toEqual(passedSubmissionResult) + mumuki.SubmissionsStore.setSubmissionResultFor(1, passedEmptyProgramSubmissionAndResult); + expect(mumuki.SubmissionsStore.getSubmissionResultFor(1, emptyProgramSubmission)).toEqual(passedSubmissionResult); }); }); @@ -90,7 +90,7 @@ describe("SubmissionsStore", () => { {solution: {content: ''}}, {solution: {content: 'bar'}})).toBe(false); }); - }) + }); describe('classic submissons', () => { it("answers true when they are equal", () => { @@ -122,7 +122,7 @@ describe("SubmissionsStore", () => { {'solution[content]': ''}, {'solution[content]': 'bar'})).toBe(false); }); - }) + }); describe('multifile submissions', () => { it("answers true when they are equal", () => { @@ -172,6 +172,6 @@ describe("SubmissionsStore", () => { 'solution[content[index.html]]': 'html foo' })).toBe(false); }); - }) + }); }); -}) +}); diff --git a/spec/javascripts/sync-mode-spec.js b/spec/javascripts/sync-mode-spec.js index 7c042f8a0..c07d757c2 100644 --- a/spec/javascripts/sync-mode-spec.js +++ b/spec/javascripts/sync-mode-spec.js @@ -4,12 +4,12 @@ describe('sync mode', () => { mumuki.syncMode._selectSyncMode(); expect(mumuki.syncMode._current instanceof mumuki.syncMode.ServerSyncMode).toBe(true); - }) + }); it('can choose local mode', () => { mumuki.incognitoUser = true; mumuki.syncMode._selectSyncMode(); expect(mumuki.syncMode._current instanceof mumuki.syncMode.ClientSyncMode).toBe(true); - }) -}) + }); +}); diff --git a/spec/javascripts/timeout-spec.js b/spec/javascripts/timeout-spec.js index e31dcc5d0..0ba877d96 100644 --- a/spec/javascripts/timeout-spec.js +++ b/spec/javascripts/timeout-spec.js @@ -1,5 +1,5 @@ describe('setTimeout', () => { it('can create setTimeout', () => { expect(mumuki.setTimeout).not.toBe(null); - }) -}) + }); +}); diff --git a/spec/javascripts/timer-spec.js b/spec/javascripts/timer-spec.js index 0a5ea268f..2d09513ef 100644 --- a/spec/javascripts/timer-spec.js +++ b/spec/javascripts/timer-spec.js @@ -1,5 +1,5 @@ describe('timer', () => { it('can create timer', () => { expect(mumuki.startTimer).not.toBe(null); - }) -}) + }); +});