diff options
Diffstat (limited to 'node_modules/snekfetch/test/node')
| -rw-r--r-- | node_modules/snekfetch/test/node/file.test.js | 47 | ||||
| -rw-r--r-- | node_modules/snekfetch/test/node/http1.test.js | 7 | ||||
| -rw-r--r-- | node_modules/snekfetch/test/node/http2.test.js.disabled | 7 | ||||
| -rw-r--r-- | node_modules/snekfetch/test/node/main.js | 26 | ||||
| -rw-r--r-- | node_modules/snekfetch/test/node/sync.test.js | 10 | ||||
| -rw-r--r-- | node_modules/snekfetch/test/node/util.test.js | 17 |
6 files changed, 0 insertions, 114 deletions
diff --git a/node_modules/snekfetch/test/node/file.test.js b/node_modules/snekfetch/test/node/file.test.js deleted file mode 100644 index 8ec0fd0..0000000 --- a/node_modules/snekfetch/test/node/file.test.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @jest-environment node - */ - -const fs = require('fs'); -const { Snekfetch } = require('../interop'); - -const resolve = (x) => require.resolve(x); - -test('node/file get', () => { - const original = fs.readFileSync(resolve('../../package.json')).toString(); - return Snekfetch.get(`file://${resolve('../../package.json')}`) - .then((res) => { - expect(res.text).toBe(original); - }); -}); - -test('node/file post', () => { - const content = 'wow this is a\n\ntest!!'; - const file = './test_file_post.txt'; - return Snekfetch.post(`file://${file}`) - .send(content) - .then(() => Snekfetch.get(`file://${file}`)) - .then((res) => { - expect(res.text).toBe(content); - }) - .then(() => { - fs.unlinkSync(file); - }); -}); - -test('node/file delete', () => { - const file = './test_file_delete.txt'; - fs.closeSync(fs.openSync(file, 'w')); - expect(fs.existsSync(file)).toBe(true); - return Snekfetch.delete(`file://${file}`) - .then(() => { - expect(fs.existsSync(file)).toBe(false); - }); -}); - - -test('node/file invalid method', () => { - expect(() => { - Snekfetch.options('file:///dev/urandom'); - }).toThrow(/Invalid request method for file:/); -}); diff --git a/node_modules/snekfetch/test/node/http1.test.js b/node_modules/snekfetch/test/node/http1.test.js deleted file mode 100644 index 00f91f4..0000000 --- a/node_modules/snekfetch/test/node/http1.test.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * @jest-environment node - */ - -global.HTTP_VERSION = 1; - -require('./main'); diff --git a/node_modules/snekfetch/test/node/http2.test.js.disabled b/node_modules/snekfetch/test/node/http2.test.js.disabled deleted file mode 100644 index daf49d9..0000000 --- a/node_modules/snekfetch/test/node/http2.test.js.disabled +++ /dev/null @@ -1,7 +0,0 @@ -/** - * @jest-environment node - */ - -global.HTTP_VERSION = 2; - -require('./main'); diff --git a/node_modules/snekfetch/test/node/main.js b/node_modules/snekfetch/test/node/main.js deleted file mode 100644 index b811ec9..0000000 --- a/node_modules/snekfetch/test/node/main.js +++ /dev/null @@ -1,26 +0,0 @@ -const fs = require('fs'); - -const { Snekfetch, TestRoot } = require('../interop'); - -require('../main'); - -test('node/pipe get', (done) => { - Snekfetch.get(`${TestRoot}/get`) - .pipe(fs.createWriteStream('/dev/null')) - .on('finish', done); -}); - - -test('node/FormData json works', () => - Snekfetch.post(`${TestRoot}/post`) - .attach('object', { a: 1 }) - .then((res) => { - const { form } = res.body; - expect(form.object).toBe('{"a":1}'); - }) -); - -test('node/rawsend post', () => - Snekfetch.post(`${TestRoot}/post`) - .send(Buffer.from('memes')).end() -); diff --git a/node_modules/snekfetch/test/node/sync.test.js b/node_modules/snekfetch/test/node/sync.test.js deleted file mode 100644 index 0c7187f..0000000 --- a/node_modules/snekfetch/test/node/sync.test.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @jest-environment node - */ - -const { SnekfetchSync, TestRoot } = require('../interop'); - -test('sync get', SnekfetchSync && (() => { - const res = SnekfetchSync.get(`${TestRoot}/get`).end(); - expect(res.body).not.toBeUndefined(); -})); diff --git a/node_modules/snekfetch/test/node/util.test.js b/node_modules/snekfetch/test/node/util.test.js deleted file mode 100644 index 1e71573..0000000 --- a/node_modules/snekfetch/test/node/util.test.js +++ /dev/null @@ -1,17 +0,0 @@ -const FormData = require('../../src/node/FormData'); -const mime = require('../../src/node/mime'); - -test('node/FormData behaves predictably', () => { - const f = new FormData(); - f.append('hello'); - f.append('hello', 'world'); - expect(f.length).toBe(77); - f.append('meme', 'dream', 'name'); - expect(f.length).toBe(210); -}); - -test('node/mimes behaves predictably', () => { - expect(mime.lookup('js')).toBe('application/javascript'); - expect(mime.lookup('nope')).toBe('application/octet-stream'); - expect(mime.buffer([0xFF, 0xD8, 0xFF])).toBe('image/jpeg'); -}); |