Merge remote-tracking branch 'origin/improvement/adding_jest' into improvement/adding_jest

This commit is contained in:
Jason
2021-06-05 16:30:43 +09:00
2 changed files with 11 additions and 9 deletions

View File

@@ -12,7 +12,9 @@
/* global Handlebars, SockJS, Stomp */
/* eslint no-undef: "error" */
import { getContextPath, getRecommendedMoviesForTable, getYear, isEqual, isNotOwned } from '../modules/common.min.js';
import {
getContextPath, getRecommendedMoviesForTable, getYear, isEqual, isNotOwned,
} from '../modules/common.min.js';
import Payload from '../modules/payload.min.js';
let libraryTitle;
@@ -218,7 +220,4 @@ jQuery(($) => {
window.copyToClipboard = copyToClipboard;
});
window.onbeforeunload = function () {
disconnect();
// return false;
};
window.onbeforeunload = disconnect;

View File

@@ -1,5 +1,8 @@
jest.mock('../__mocks__/getRecommendedMovies');
import { getYear, isEqual, isNotOwned, getRecommendedMoviesForTable } from '../GapsWeb/src/main/resources/static/js/modules/common';
/* global test, expect */
import {
getYear, isEqual, isNotOwned,
} from '../GapsWeb/src/main/resources/static/js/modules/common.js';
test('Checks for valid year', () => {
expect(getYear(2005)).toBe(' (2005)');
@@ -18,11 +21,11 @@ test('Checks for no year', () => {
});
test('Two equal TMDB IDs', () => {
expect(isEqual(1234567,1234567)).toBe(true);
expect(isEqual(1234567, 1234567)).toBe(true);
});
test('Two unequal TMDB IDs', () => {
expect(isEqual(1234567,7654321)).toBe(false);
expect(isEqual(1234567, 7654321)).toBe(false);
});
test('Should be owned', () => {