Skip to content

Commit

Permalink
tests: fix linter errors in scaffold.js
Browse files Browse the repository at this point in the history
  • Loading branch information
NovemLinguae committed Oct 19, 2024
1 parent 2b33a3d commit f14ea7b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"no-shadow": "off",
"no-undef": "warn",
"no-underscore-dangle": "off",
"no-unused-vars": "warn",
"prefer-const": "warn",
"security/detect-non-literal-regexp": "off",
"security/detect-unsafe-regex": "off",
Expand Down
16 changes: 6 additions & 10 deletions tests/scaffold.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

jest.autoMockOff();

fs = require( 'fs' );
const fs = require( 'fs' );

// Mocked later
mediaWiki = mw = {};
Expand All @@ -34,11 +34,7 @@ mw.loader = {

const basePageHtml = fs.readFileSync( './tests/test-frame.html' ).toString();

requireScript = function ( name ) {
return require( './../src/' + name );
};

setPageTitle = function ( title ) {
const setPageTitle = function ( title ) {
mw.config.get.mockImplementation( ( requested ) => {
if ( requested === 'wgPageName' ) {
return title;
Expand All @@ -50,17 +46,17 @@ setPageTitle = function ( title ) {
} );
};

resetToBase = function () {
const resetToBase = function () {
// Set the base document content using jsdom
document.documentElement.innerHtml = basePageHtml;
AFCH = undefined;
jQuery = $ = require( 'jquery' );
const jQuery = $ = require( 'jquery' );
};

resetToBase();

resetToAFCApplicablePage = function () {
const resetToAFCApplicablePage = function () {
resetToBase();
setPageTitle( 'Draft:Foo' );
requireScript( 'afch.js' );
require( './../src/afch.js' );
};
2 changes: 1 addition & 1 deletion tests/test-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require( './scaffold.js' );

resetToAFCApplicablePage();

requireScript( 'modules/core.js' );
require( './../src/modules/core.js' );

// It's always good to start simple :)
describe( 'AFCH', () => {
Expand Down

0 comments on commit f14ea7b

Please sign in to comment.