Skip to content

Commit

Permalink
switch to true|false for protectionsState param (#2326)
Browse files Browse the repository at this point in the history
Co-authored-by: Shane Osbourne <sosbourne@duckduckgo.com>
  • Loading branch information
shakyShane and Shane Osbourne committed Nov 10, 2023
1 parent 5881677 commit 0529970
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion shared/js/background/broken-site-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export async function breakageReportForTab ({
ctlYouTube,
ctlFacebookPlaceholderShown,
ctlFacebookLogin,
protectionsState: tab.site.isFeatureEnabled('contentBlocking') ? '1' : '0'
protectionsState: tab.site.isFeatureEnabled('contentBlocking')
})

for (const [key, value] of Object.entries(requestCategories)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ describe('Broken Site Reporting tests / protections state', () => {
spyOnProperty(tab.site, 'enabledFeatures').and.returnValue(['contentBlocking'])

const params = await submit(tab)
expect(params.get('protectionsState')).toEqual('1')
expect(params.get('protectionsState')).toEqual('true')
})
it('sends 1 when site is denylisted', async () => {
const tab = new Tab({ url: 'https://example.com' })
Expand All @@ -165,15 +165,15 @@ describe('Broken Site Reporting tests / protections state', () => {
spyOnProperty(tab.site, 'denylisted').and.returnValue(true)

const params = await submit(tab)
expect(params.get('protectionsState')).toEqual('1')
expect(params.get('protectionsState')).toEqual('true')
})
it('sends 0 when site is allowlisted', async () => {
const tab = new Tab({ url: 'https://example.com' })
spyOnProperty(tab.site, 'enabledFeatures').and.returnValue(['contentBlocking'])
spyOnProperty(tab.site, 'allowlisted').and.returnValue(true)

const params = await submit(tab)
expect(params.get('protectionsState')).toEqual('0')
expect(params.get('protectionsState')).toEqual('false')
})
it('sends 0 when contentBlocking is not enabled', async () => {
const tab = new Tab({ url: 'https://example.com' })
Expand All @@ -182,7 +182,7 @@ describe('Broken Site Reporting tests / protections state', () => {
spyOnProperty(tab.site, 'enabledFeatures').and.returnValue([])

const params = await submit(tab)
expect(params.get('protectionsState')).toEqual('0')
expect(params.get('protectionsState')).toEqual('false')
})
it('sends 0 when domain is in unprotectedTemporary', async () => {
const tab = new Tab({ url: 'https://example.com' })
Expand All @@ -191,6 +191,6 @@ describe('Broken Site Reporting tests / protections state', () => {
spyOnProperty(tab.site, 'isBroken').and.returnValue(true)

const params = await submit(tab)
expect(params.get('protectionsState')).toEqual('0')
expect(params.get('protectionsState')).toEqual('false')
})
})

0 comments on commit 0529970

Please sign in to comment.