Skip to content

Commit

Permalink
[Snyk] Upgrade winston from 3.2.1 to 3.3.2 (#6799)
Browse files Browse the repository at this point in the history
* fix: upgrade winston from 3.2.1 to 3.3.2

Snyk has created this PR to upgrade winston from 3.2.1 to 3.3.2.

See this package in NPM:
https://www.npmjs.com/package/winston

See this project in Snyk:
https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr

* fix tests

Co-authored-by: Diamond Lewis <findlewis@gmail.com>
  • Loading branch information
snyk-bot and dplewis authored Aug 20, 2020
1 parent d87dac1 commit bff0ea9
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 67 deletions.
142 changes: 87 additions & 55 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"subscriptions-transport-ws": "0.9.17",
"tv4": "1.3.0",
"uuid": "8.3.0",
"winston": "3.2.1",
"winston": "3.3.2",
"winston-daily-rotate-file": "4.5.0",
"ws": "7.3.1"
},
Expand Down
22 changes: 11 additions & 11 deletions spec/FilesController.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const mockAdapter = {

// Small additional tests to improve overall coverage
describe('FilesController', () => {
it('should properly expand objects', (done) => {
it('should properly expand objects', done => {
const config = Config.get(Parse.applicationId);
const gridStoreAdapter = new GridFSBucketAdapter(
'mongodb://localhost:27017/parse'
Expand All @@ -48,7 +48,7 @@ describe('FilesController', () => {
done();
});

it('should create a server log on failure', (done) => {
it('should create a server log on failure', done => {
const logController = new LoggerController(new WinstonLoggerAdapter());

reconfigureServer({ filesAdapter: mockAdapter })
Expand All @@ -57,28 +57,28 @@ describe('FilesController', () => {
() => done.fail('should not succeed'),
() => setImmediate(() => Promise.resolve('done'))
)
.then(() => new Promise((resolve) => setTimeout(resolve, 200)))
.then(() => new Promise(resolve => setTimeout(resolve, 200)))
.then(() =>
logController.getLogs({ from: Date.now() - 1000, size: 1000 })
)
.then((logs) => {
.then(logs => {
// we get two logs here: 1. the source of the failure to save the file
// and 2 the message that will be sent back to the client.

const log1 = logs.find(
(x) => x.message === 'Error creating a file: it failed with xyz'
x => x.message === 'Error creating a file: it failed with xyz'
);
expect(log1.level).toBe('error');

const log2 = logs.find((x) => x.message === 'it failed with xyz');
const log2 = logs.find(x => x.message === 'it failed with xyz');
expect(log2.level).toBe('error');
expect(log2.code).toBe(130);

done();
});
});

it('should create a parse error when a string is returned', (done) => {
it('should create a parse error when a string is returned', done => {
const mock2 = mockAdapter;
mock2.validateFilename = () => {
return 'Bad file! No biscuit!';
Expand All @@ -91,7 +91,7 @@ describe('FilesController', () => {
done();
});

it('should add a unique hash to the file name when the preserveFileName option is false', (done) => {
it('should add a unique hash to the file name when the preserveFileName option is false', done => {
const config = Config.get(Parse.applicationId);
const gridStoreAdapter = new GridFSBucketAdapter(
'mongodb://localhost:27017/parse'
Expand All @@ -114,7 +114,7 @@ describe('FilesController', () => {
done();
});

it('should not add a unique hash to the file name when the preserveFileName option is true', (done) => {
it('should not add a unique hash to the file name when the preserveFileName option is true', done => {
const config = Config.get(Parse.applicationId);
const gridStoreAdapter = new GridFSBucketAdapter(
'mongodb://localhost:27017/parse'
Expand Down Expand Up @@ -145,7 +145,7 @@ describe('FilesController', () => {
expect(result).toEqual({});
});

it('should reject slashes in file names', (done) => {
it('should reject slashes in file names', done => {
const gridStoreAdapter = new GridFSBucketAdapter(
'mongodb://localhost:27017/parse'
);
Expand All @@ -154,7 +154,7 @@ describe('FilesController', () => {
done();
});

it('should also reject slashes in file names', (done) => {
it('should also reject slashes in file names', done => {
const gridStoreAdapter = new GridStoreAdapter(
'mongodb://localhost:27017/parse'
);
Expand Down

0 comments on commit bff0ea9

Please sign in to comment.