1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-06-17 13:56:01 +00:00

updated all commands and removed some weird files

This commit is contained in:
MatteZ02
2019-08-14 15:26:33 +03:00
parent 29b40867a3
commit 9d7e55b5ee
1058 changed files with 170671 additions and 70 deletions

47
node_modules/snekfetch/test/node/file.test.js generated vendored Normal file
View File

@ -0,0 +1,47 @@
/**
* @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:/);
});

7
node_modules/snekfetch/test/node/http1.test.js generated vendored Normal file
View File

@ -0,0 +1,7 @@
/**
* @jest-environment node
*/
global.HTTP_VERSION = 1;
require('./main');

View File

@ -0,0 +1,7 @@
/**
* @jest-environment node
*/
global.HTTP_VERSION = 2;
require('./main');

26
node_modules/snekfetch/test/node/main.js generated vendored Normal file
View File

@ -0,0 +1,26 @@
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()
);

10
node_modules/snekfetch/test/node/sync.test.js generated vendored Normal file
View File

@ -0,0 +1,10 @@
/**
* @jest-environment node
*/
const { SnekfetchSync, TestRoot } = require('../interop');
test('sync get', SnekfetchSync && (() => {
const res = SnekfetchSync.get(`${TestRoot}/get`).end();
expect(res.body).not.toBeUndefined();
}));

17
node_modules/snekfetch/test/node/util.test.js generated vendored Normal file
View File

@ -0,0 +1,17 @@
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');
});