-
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename mwApiPath to mwActionApiPath, add e2e tests for mw api path pa…
…rams
- Loading branch information
1 parent
90cbb38
commit aa979c1
Showing
26 changed files
with
136 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { testAllRenders } from '../testAllRenders.js' | ||
import { zimcheck } from '../util.js' | ||
import 'dotenv/config.js' | ||
import { jest } from '@jest/globals' | ||
import rimraf from 'rimraf' | ||
import { sanitizeApiPathParam, sanitizeWikiPath } from '../../src/sanitize-argument.js' | ||
|
||
jest.setTimeout(60000) | ||
|
||
const parameters = { | ||
mwUrl: 'https://en.wikipedia.org', | ||
articleList: 'BMW', | ||
adminEmail: '[email protected]', | ||
mwActionApiPath: sanitizeApiPathParam('/w/api.php'), | ||
mwRestApiPath: sanitizeApiPathParam('/api/rest_v1'), | ||
mwModulePath: sanitizeApiPathParam('/w/load.php'), | ||
mwWikiPath: sanitizeWikiPath('/'), | ||
} | ||
|
||
await testAllRenders(parameters, async (outFiles) => { | ||
describe(`e2e test for api url params for en.wikipedia.org for ${outFiles[0]?.renderer} renderer`, () => { | ||
test('Mediawiki actionApiPath ', () => { | ||
expect(outFiles[0].mwMetaData.actionApiPath).toBe('w/api.php') | ||
}) | ||
|
||
test('Mediawiki restApiPath option', () => { | ||
expect(outFiles[0].mwMetaData.restApiPath).toBe('api/rest_v1') | ||
}) | ||
|
||
test('Mediawiki wikiPath option', () => { | ||
expect(outFiles[0].mwMetaData.wikiPath).toBe('') | ||
}) | ||
|
||
test('Mediawiki modulePathOpt option', () => { | ||
expect(outFiles[0].mwMetaData.modulePathOpt).toBe('w/load.php') | ||
}) | ||
|
||
test('Mediawiki modulePath and actionApiUrl options', () => { | ||
expect(outFiles[0].mwMetaData.modulePath).toBe('https://en.wikipedia.org/w/load.php?') | ||
expect(outFiles[0].mwMetaData.actionApiUrl).toBe('https://en.wikipedia.org/w/api.php') | ||
}) | ||
|
||
test(`test zim integrity for ${outFiles[0]?.renderer} renderer`, async () => { | ||
await expect(zimcheck(outFiles[0].outFile)).resolves.not.toThrowError() | ||
}) | ||
|
||
afterAll(() => { | ||
rimraf.sync(`./${outFiles[0].testId}`) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ const parameters = { | |
adminEmail: '[email protected]', | ||
redis: process.env.REDIS, | ||
format: ['nopic'], | ||
mwApiPath: 'w/api.php', | ||
mwActionApiPath: 'w/api.php', | ||
mwWikiPath: '/', | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ const parameters = { | |
mwUrl: 'https://en.wikipedia.org', | ||
articleList: 'BMW', | ||
adminEmail: '[email protected]', | ||
mwApiPath: 'w/api.php', | ||
mwActionApiPath: 'w/api.php', | ||
mwWikiPath: '/', | ||
} | ||
|
||
|
Oops, something went wrong.