-
-
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.
Merge pull request #1905 from openzim/1904-aws-js-sdk-v3-hotfix
Convert S3 response body from IncomingMessage object to Buffer
- Loading branch information
Showing
2 changed files
with
54 additions
and
1 deletion.
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
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: '[email protected]', | ||
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('') | ||
}) | ||
}) |