-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gatsby-plugin-sharp): Allow brackets in paths (#18289)
* fix(gatsby-plugin-sharp): Allow brackets in paths * Add tests to assert brackets in paths are set correctly * Fix linting issues * Fix already queued job not being returned properly * Reapply my initial fix for brackets in paths. * Fix setJobToProcess test
- Loading branch information
1 parent
db3f7b0
commit f9933b1
Showing
3 changed files
with
77 additions
and
19 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
packages/gatsby-plugin-sharp/src/__tests__/__snapshots__/scheduler.js.snap
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`setJobToProcess allows brackets in paths 1`] = ` | ||
Object { | ||
"1234/file%2Ejpg": Object { | ||
"myoutputpath/1234/file[new]%2Ejpg": Object { | ||
"deferred": Object { | ||
"promise": Promise {}, | ||
"reject": [Function], | ||
"resolve": [Function], | ||
}, | ||
"job": Object { | ||
"args": Object {}, | ||
"contentDigest": "8675309jenny", | ||
"inputPath": "1234/file.jpg", | ||
"outputPath": "myoutputpath/1234/file[new].jpg", | ||
}, | ||
}, | ||
}, | ||
} | ||
`; |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const { setJobToProcess } = require(`../scheduler`) | ||
|
||
describe(`setJobToProcess`, () => { | ||
it(`allows brackets in paths`, () => { | ||
let deferred = {} | ||
deferred.promise = new Promise((resolve, reject) => { | ||
deferred.resolve = resolve | ||
deferred.reject = reject | ||
}) | ||
const toProcess = {} | ||
const job = { | ||
args: {}, | ||
inputPath: `1234/file.jpg`, | ||
contentDigest: `8675309jenny`, | ||
outputPath: `myoutputpath/1234/file[new].jpg`, | ||
} | ||
setJobToProcess(toProcess, job, deferred) | ||
expect(toProcess).toMatchSnapshot() | ||
}) | ||
}) |
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