-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add e2e test for optimisationCacheUrl parameter
- Loading branch information
1 parent
5a17fee
commit 75e4fea
Showing
1 changed file
with
42 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import * as mwoffliner from '../../src/mwoffliner.lib.js' | ||
import { execa } from 'execa' | ||
import rimraf from 'rimraf' | ||
import { zimcheckAvailable, zimcheck } from '../util.js' | ||
import 'dotenv/config.js' | ||
import { jest } from '@jest/globals' | ||
|
||
jest.setTimeout(200000) | ||
|
||
const describeIf = process.env.S3_URL ? describe : describe.skip | ||
describeIf('Check image downloading from S3 using optimisationCacheUrl parameter', () => { | ||
const now = new Date() | ||
const testId = `mwo-test-${+now}` | ||
|
||
const parameters = { | ||
mwUrl: 'https://fr.wikipedia.org', | ||
adminEmail: 'test@kiwix.org', | ||
outputDirectory: testId, | ||
redis: process.env.REDIS, | ||
articleList: 'Paris', | ||
format: ['nodet'], | ||
optimisationCacheUrl: process.env.S3_URL, | ||
} | ||
|
||
test('right scrapping from fr.wikipedia.org with optimisationCacheUrl parameter', async () => { | ||
await execa('redis-cli flushall', { shell: true }) | ||
|
||
const outFiles = await mwoffliner.execute(parameters) | ||
|
||
if (await zimcheckAvailable()) { | ||
await expect(zimcheck(outFiles[0].outFile)).resolves.not.toThrowError() | ||
} else { | ||
console.log('Zimcheck not installed, skipping test') | ||
} | ||
|
||
rimraf.sync(`./${testId}`) | ||
|
||
const redisScan = await execa('redis-cli --scan', { shell: true }) | ||
// Redis has been cleared | ||
expect(redisScan.stdout).toEqual('') | ||
}) | ||
}) |