-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from jy95/prettier
Prettier
- Loading branch information
Showing
14 changed files
with
3,537 additions
and
2,994 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,91 @@ | ||
'use strict'; | ||
"use strict"; | ||
|
||
// need to manually mock these function as there is no solution : https://github.com/facebook/jest/issues/5589 | ||
// here ; a short truncated copy of babel stuff of this class | ||
function _possibleConstructorReturn(self, call) { | ||
if (!self) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return call && (typeof call === "object" || typeof call === "function") ? call : self; | ||
if (!self) { | ||
throw new ReferenceError( | ||
"this hasn't been initialised - super() hasn't been called" | ||
); | ||
} | ||
return call && (typeof call === "object" || typeof call === "function") | ||
? call | ||
: self; | ||
} | ||
|
||
var _createClass = function () { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
var _createClass = (function() { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
|
||
return function (Constructor, protoProps, staticProps) { | ||
if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
}; | ||
}(); | ||
return function(Constructor, protoProps, staticProps) { | ||
if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
}; | ||
})(); | ||
|
||
// truncated version of this stuff | ||
var FileHound = function () { | ||
var FileHound = (function() { | ||
// temp files | ||
let result; | ||
|
||
// temp files | ||
let result; | ||
|
||
function FileHound() { | ||
var _this = _possibleConstructorReturn(this, (FileHound.__proto__ || Object.getPrototypeOf(FileHound)).call(this)); | ||
return _this; | ||
} | ||
function FileHound() { | ||
var _this = _possibleConstructorReturn( | ||
this, | ||
(FileHound.__proto__ || Object.getPrototypeOf(FileHound)).call(this) | ||
); | ||
return _this; | ||
} | ||
|
||
_createClass(FileHound, [ | ||
{ | ||
key: 'paths', | ||
value: function paths() { | ||
return this; | ||
} | ||
}, | ||
{ | ||
key: 'ext', | ||
value: function ext() { | ||
return this; | ||
} | ||
}, | ||
{ | ||
key: 'find', | ||
value: function find() { | ||
if (result !== undefined) { | ||
return Promise.resolve(result); | ||
} | ||
// if nothing provided , throw error | ||
return Promise.reject("VAUDOU"); | ||
} | ||
}], [{ | ||
key: 'create', | ||
_createClass( | ||
FileHound, | ||
[ | ||
{ | ||
key: "paths", | ||
value: function paths() { | ||
return this; | ||
} | ||
}, | ||
{ | ||
key: "ext", | ||
value: function ext() { | ||
return this; | ||
} | ||
}, | ||
{ | ||
key: "find", | ||
value: function find() { | ||
if (result !== undefined) { | ||
return Promise.resolve(result); | ||
} | ||
// if nothing provided , throw error | ||
return Promise.reject("VAUDOU"); | ||
} | ||
} | ||
], | ||
[ | ||
{ | ||
key: "create", | ||
value: function create() { | ||
return new FileHound(); | ||
return new FileHound(); | ||
} | ||
}, { | ||
key: '__setResult', | ||
value: function (ExpectedResult) { | ||
result = ExpectedResult; | ||
}, | ||
{ | ||
key: "__setResult", | ||
value: function(ExpectedResult) { | ||
result = ExpectedResult; | ||
} | ||
}]); | ||
} | ||
] | ||
); | ||
|
||
return FileHound; | ||
}(); | ||
module.exports = FileHound; | ||
return FileHound; | ||
})(); | ||
module.exports = FileHound; |
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 |
---|---|---|
@@ -1,21 +1,21 @@ | ||
'use strict'; | ||
const fs = jest.genMockFromModule('fs'); | ||
"use strict"; | ||
const fs = jest.genMockFromModule("fs"); | ||
|
||
// temp files | ||
let mockPaths = []; | ||
|
||
function access(path, mode, callback) { | ||
if (!mockPaths.includes(path)) { | ||
callback(new Error("VAUDOU")); | ||
} | ||
callback(); | ||
if (!mockPaths.includes(path)) { | ||
callback(new Error("VAUDOU")); | ||
} | ||
callback(); | ||
} | ||
|
||
function __setMockPaths(pathArray) { | ||
mockPaths = pathArray; | ||
mockPaths = pathArray; | ||
} | ||
|
||
fs.access = access; | ||
fs.__setMockPaths = __setMockPaths; | ||
|
||
module.exports = fs; | ||
module.exports = fs; |
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
Oops, something went wrong.