Skip to content

Commit

Permalink
fix(mv3): gateway-redirect tests now fixed.
Browse files Browse the repository at this point in the history
Signed-off-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>
  • Loading branch information
whizzzkid committed Jul 19, 2023
1 parent 0de2e89 commit 1d46a57
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 5 additions & 4 deletions test/functional/lib/ipfs-request-gateway-redirect.test.mv3.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ import { createRequestModifier } from '../../../add-on/src/lib/ipfs-request.js'
import { optionDefaults } from '../../../add-on/src/lib/options.js'
import createRuntimeChecks from '../../../add-on/src/lib/runtime-checks.js'
import { initState } from '../../../add-on/src/lib/state.js'
import { generateAddRule } from '../../../add-on/src/lib/redirect-handler/blockOrObserve.js'
import { cleanupRules, generateAddRule } from '../../../add-on/src/lib/redirect-handler/blockOrObserve.js'

const url2request = (string) => {
return { url: string, type: 'main_frame' }
}

const fakeRequestId = () => {
return Math.floor(Math.random() * 100000).toString()
}

const expectNoRedirect = async (modifyRequest, request, browser) => {
await modifyRequest.onBeforeRequest(request)
Expand All @@ -39,6 +36,10 @@ describe('[MV3] modifyRequest.onBeforeRequest:', function () {
browser.runtime.getURL.returns('chrome-extension://testid/')
})

afterEach(async function () {
await cleanupRules(true)
})

beforeEach(async function () {
state = Object.assign(initState(optionDefaults), {
ipfsNodeType: 'external',
Expand Down
1 change: 0 additions & 1 deletion test/setup/mocha-setup.mv3.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ global.browser.declarativeNetRequest = sinonSandbox.spy(new DeclarativeNetReques

afterEach(function () {
sinonSandbox.resetHistory()
browser.flush()
})

0 comments on commit 1d46a57

Please sign in to comment.