Skip to content

Commit

Permalink
fix: Small renaming and corrections after review
Browse files Browse the repository at this point in the history
  • Loading branch information
KillianCourvoisier committed Jul 26, 2024
1 parent df6ba20 commit e0f0eee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
11 changes: 4 additions & 7 deletions packages/cozy-clisk/src/contentscript/ContentScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ export default class ContentScript {
suffixFn: args => args?.[0]
}
)
this.shouldFullSync = wrapTimerDebug(this, 'shouldFullSync')

if (options.requestInterceptor) {
this.requestInterceptor = options.requestInterceptor
this.requestInterceptor.setLogger(this.log.bind(this))
Expand Down Expand Up @@ -137,8 +135,7 @@ export default class ContentScript {
'getDebugData',
'getCliskVersion',
'checkForElement',
'evaluate',
'shouldFullSync'
'evaluate'
]

if (options.additionalExposedMethodsNames) {
Expand Down Expand Up @@ -939,10 +936,10 @@ export default class ContentScript {
this.onlyIn(PILOT_TYPE, 'shouldFullSync')
const { trigger, flags } = options
let forceFullSync = false
let userFullSync = false
let flagFullSync = false
if (flags['clisk.force-full-sync'] === true) {
this.log('info', 'User forces full sync')
userFullSync = true
flagFullSync = true
}
const isFirstJob =
!trigger.current_state?.last_failure &&
Expand All @@ -959,7 +956,7 @@ export default class ContentScript {
}
this.log('debug', `distanceInDays: ${distanceInDays}`)
if (
userFullSync ||
flagFullSync ||
!hasLastExecution ||
isLastJobError ||
distanceInDays >= 30
Expand Down
8 changes: 4 additions & 4 deletions packages/cozy-clisk/src/contentscript/ContentScript.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ describe('ContentScript', () => {
})
})
describe('shouldFullSync', () => {
it('should force full sync => Flag', async () => {
it('should force full sync if forceFullSync flag is activated', async () => {
const contentScript = new ContentScript()
contentScript.contentScriptType = PILOT_TYPE

Expand All @@ -222,7 +222,7 @@ describe('ContentScript', () => {
distanceInDays: 0
})
})
it('should force full sync => First execution', async () => {
it('should force full sync if it is the first execution', async () => {
const contentScript = new ContentScript()
contentScript.contentScriptType = PILOT_TYPE

Expand All @@ -240,7 +240,7 @@ describe('ContentScript', () => {
distanceInDays: 0
})
})
it('should force full sync => Last execution failed', async () => {
it('should force full sync if the last execution failed', async () => {
const contentScript = new ContentScript()
contentScript.contentScriptType = PILOT_TYPE

Expand All @@ -262,7 +262,7 @@ describe('ContentScript', () => {
distanceInDays: 0
})
})
it('should not force full sync', async () => {
it('should not force full sync in nominal case', async () => {
const contentScript = new ContentScript()
contentScript.contentScriptType = PILOT_TYPE

Expand Down

0 comments on commit e0f0eee

Please sign in to comment.