-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: auto create upload dir * chore: explain more on symbols
- Loading branch information
1 parent
f39b8bf
commit 8c15d5b
Showing
3 changed files
with
66 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import Fastify from 'fastify' | ||
import * as fs from 'fs' | ||
import * as path from 'path' | ||
import FastifyFormidable from '../lib' | ||
|
||
const uploadDir = path.resolve('tmp') | ||
|
||
describe('uploadDir', function () { | ||
test('create', async function () { | ||
const fastify = Fastify() | ||
await fastify.register(FastifyFormidable, { | ||
formidable: { | ||
uploadDir | ||
} | ||
}) | ||
|
||
const stat = await fs.promises.lstat(uploadDir) | ||
expect(stat.isDirectory()).toStrictEqual(true) | ||
}) | ||
|
||
afterEach(async function () { | ||
// clean up | ||
await fs.promises.rmdir(uploadDir) | ||
}) | ||
}) |