JavaScript
Usage of higher-order function

by Benny Neugebauer

// Higher-order function (function which returns a function)
const checkPathTraversal = (...testPaths) => () => FileEngine.checkPathTraversal(...testPaths);
expect(checkPathTraversal('../etc', 'a')).toThrowError(StoreEngineError.PathValidationError);

expect(() => {
  FileEngine.checkPathTraversal('../etc', 'a');
}).toThrowError(StoreEngineError.PathValidationError);