Skip to content

Commit

Permalink
Fix simple
Browse files Browse the repository at this point in the history
  • Loading branch information
qtomlinson committed Jul 7, 2024
1 parent d512582 commit 2fc4a8e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function buildRequestOptions(request) {
}

const validateOptions = {}
if (!request.simple) {
if (request.simple === false) {
validateOptions.validateStatus = () => true
}

Expand Down
24 changes: 24 additions & 0 deletions test/unit/providers/fetch/mavenBasedFetchTests.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const { expect } = require('chai')
const MavenBasedFetch = require('../../../../providers/fetch/mavenBasedFetch')
const mockttp = require('mockttp')
const sinon = require('sinon')
const Request = require('../../../../ghcrawler').request

describe('MavenBasedFetch', () => {
describe('find contained file stat', () => {
Expand All @@ -16,4 +19,25 @@ describe('MavenBasedFetch', () => {
expect(file.mtime.toISOString().includes('2022-02-24'))
})
})

describe('Integration test for component not found', function () {
const path = '/remotecontent?filepath='
const mockServer = mockttp.getLocal()
beforeEach(async () => await mockServer.start())
afterEach(async () => await mockServer.stop())

it('should handle maven components not found', async () => {
const handler = new MavenBasedFetch(
{
mavencentral: mockServer.urlFor(path)
},
{ logger: { log: sinon.stub() } }
)
await mockServer.forAnyRequest().thenReply(404)
const request = await handler.handle(
new Request('test', 'cd:/maven/mavencentral/org.apache.httpcomponents/httpcore/4.')
)
expect(request.processControl).to.be.equal('skip')
})
})
})

0 comments on commit 2fc4a8e

Please sign in to comment.