mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 04:23:31 +01:00
refactor(files): file data can be much more than buffer (#7238)
This commit is contained in:
@@ -115,10 +115,10 @@ test('postFile empty', async () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('postFile file', async () => {
|
||||
test('postFile file (string)', async () => {
|
||||
expect(
|
||||
await api.post('/postFile', {
|
||||
files: [{ fileName: 'out.txt', rawBuffer: Buffer.from('Hello') }],
|
||||
files: [{ fileName: 'out.txt', fileData: 'Hello' }],
|
||||
}),
|
||||
).toStrictEqual({
|
||||
body: [
|
||||
@@ -133,7 +133,7 @@ test('postFile file', async () => {
|
||||
test('postFile file and JSON', async () => {
|
||||
expect(
|
||||
await api.post('/postFile', {
|
||||
files: [{ fileName: 'out.txt', rawBuffer: Buffer.from('Hello') }],
|
||||
files: [{ fileName: 'out.txt', fileData: Buffer.from('Hello') }],
|
||||
body: { foo: 'bar' },
|
||||
}),
|
||||
).toStrictEqual({
|
||||
@@ -153,8 +153,8 @@ test('postFile files and JSON', async () => {
|
||||
expect(
|
||||
await api.post('/postFile', {
|
||||
files: [
|
||||
{ fileName: 'out.txt', rawBuffer: Buffer.from('Hello') },
|
||||
{ fileName: 'out.txt', rawBuffer: Buffer.from('Hi') },
|
||||
{ fileName: 'out.txt', fileData: Buffer.from('Hello') },
|
||||
{ fileName: 'out.txt', fileData: Buffer.from('Hi') },
|
||||
],
|
||||
body: { files: [{ id: 0, description: 'test' }] },
|
||||
}),
|
||||
@@ -178,7 +178,7 @@ test('postFile files and JSON', async () => {
|
||||
test('postFile sticker and JSON', async () => {
|
||||
expect(
|
||||
await api.post('/postFile', {
|
||||
files: [{ key: 'file', fileName: 'sticker.png', rawBuffer: Buffer.from('Sticker') }],
|
||||
files: [{ key: 'file', fileName: 'sticker.png', fileData: Buffer.from('Sticker') }],
|
||||
body: { foo: 'bar' },
|
||||
appendToFormData: true,
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user