Skip to content

Commit

Permalink
tests: fix linter errors in scaffold.js (#389)
Browse files Browse the repository at this point in the history
* tests: fix linter errors in scaffold.js

* fix test failure
  • Loading branch information
NovemLinguae authored Oct 20, 2024
1 parent efcea65 commit efce891
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 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
12 changes: 4 additions & 8 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,7 +46,7 @@ setPageTitle = function ( title ) {
} );
};

resetToBase = function () {
const resetToBase = function () {
// Set the base document content using jsdom
document.documentElement.innerHtml = basePageHtml;
AFCH = undefined;
Expand All @@ -62,5 +58,5 @@ resetToBase();
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 efce891

Please sign in to comment.