Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Collina <hello@matteocollina.com>
  • Loading branch information
mcollina committed Mar 29, 2024
1 parent af6e4c5 commit 8daf397
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/issue-288.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { test } = require('tap')
const Fastify = require('fastify')
const fastifyCompress = require('..')
const fsPromises = require("fs").promises
const fsPromises = require('fs').promises
const { join } = require('path')
const { fetch } = require('undici')

Expand All @@ -14,17 +14,17 @@ test('should not corrupt the file content', async (t) => {
fastify.register(async (instance, opts) => {
await fastify.register(fastifyCompress)
instance.get('/issue', async (req, reply) => {
const longStringWithEmoji = await fsPromises.readFile(join(__dirname, "./test.txt"), "utf-8");
const longStringWithEmoji = await fsPromises.readFile(join(__dirname, './test.txt'), 'utf-8')

return longStringWithEmoji // <--- the file content is corrupt
return longStringWithEmoji // <--- the file content is corrupt
// search for "hydra.alibaba.com" will see 2 wired question marks instead of emoji
})
})

fastify.get('/good', async (req, reply) => {
const longStringWithEmoji = await fsPromises.readFile(join(__dirname, "./test.txt"), "utf-8");
const longStringWithEmoji = await fsPromises.readFile(join(__dirname, './test.txt'), 'utf-8')

return longStringWithEmoji // <--- the file content is ok
return longStringWithEmoji // <--- the file content is ok
// search for "hydra.alibaba.com" will see emoji
})

Expand Down

0 comments on commit 8daf397

Please sign in to comment.