-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor mwApiPath (to mwActionApiPath), mwRestApiPath, mwModulePath and mwWikiPath parameters + fix regression of test render template #1939
Merged
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2a152b5
Rollback mwActionApiPath to mwApiPath
VadimKovalenkoSNF 1f2ed9f
Refactor buildURL() calculation to include mwWikiPath
VadimKovalenkoSNF c7c6615
Add tests for handling mwApiPath and mwWikiPath params in base url di…
VadimKovalenkoSNF 95a5460
Update modulePath handling in Mediawiki
VadimKovalenkoSNF 10d6e76
Adjust tests, comment out VE capabilities check, refactor e2e test te…
VadimKovalenkoSNF 5a27896
Add optionalRenderesList param to the testAllRenders template, fix is…
VadimKovalenkoSNF c5fe022
Refactor rimraf invocation in e2e tests
VadimKovalenkoSNF 39de207
Optimize renderer builder and temporary disable VE test for it
VadimKovalenkoSNF c4ef4c4
Fixed issue with unconditional MW params setters side effects
VadimKovalenkoSNF e6078f1
Rename mwApiPath to mwActionApiPath, add e2e tests for mw api path pa…
VadimKovalenkoSNF ebf85b5
Temp remove VE from wikisource.e2e.test.ts render list
VadimKovalenkoSNF 9b64386
Fix Mediawiki.wikiPath setter
VadimKovalenkoSNF 8422cb0
Make default mwWikiPath as empty string
VadimKovalenkoSNF d3b0125
Refactor mwWikiPath, bring it back as 'wiki/' default value
VadimKovalenkoSNF File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Rename mwApiPath to mwActionApiPath, add e2e tests for mw api path pa…
…rams
- Loading branch information
commit e6078f1c967610ada4a67b7e15af780709ed1640
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: 'test@kiwix.org', | ||
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, here the
mwWikiPath
value should be takenThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored this. Also, 'wiki/' value is default again.