Skip to content

Commit

Permalink
fix: update way that cohorts are cached to remove duplicate key (#23985)
Browse files Browse the repository at this point in the history
  • Loading branch information
warrensplayer authored Sep 26, 2022
1 parent 26a71fe commit 88ecb1e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions packages/server/lib/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,23 @@ module.exports = {
},

getCohorts () {
return fileUtil.get('COHORTS', {})
return fileUtil.get('COHORTS', {}).then((cohorts) => {
Object.keys(cohorts).forEach((key) => {
cohorts[key].name = key
})

return cohorts
})
},

insertCohort (cohort) {
return fileUtil.transaction((tx) => {
return tx.get('COHORTS', {}).then((cohorts) => {
return tx.set('COHORTS', {
...cohorts,
[cohort.name]: cohort,
[cohort.name]: {
cohort: cohort.cohort,
},
})
})
})
Expand Down
2 changes: 1 addition & 1 deletion packages/server/test/unit/cohort_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('lib/cohort', () => {

return cohorts.set(cohortTest).then(() => {
return cohorts.getByName(cohortTest.name).then((cohort) => {
expect(cohort).to.eq(cohortTest)
expect(cohort).to.deep.eq(cohortTest)
})
})
})
Expand Down

5 comments on commit 88ecb1e

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 88ecb1e Sep 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.9.0/linux-arm64/develop-88ecb1e94985ae623365561cc0fd422128e1a3e8/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 88ecb1e Sep 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.9.0/linux-x64/develop-88ecb1e94985ae623365561cc0fd422128e1a3e8/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 88ecb1e Sep 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin arm64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.9.0/darwin-arm64/develop-88ecb1e94985ae623365561cc0fd422128e1a3e8/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 88ecb1e Sep 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.9.0/darwin-x64/develop-88ecb1e94985ae623365561cc0fd422128e1a3e8/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 88ecb1e Sep 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.9.0/win32-x64/develop-88ecb1e94985ae623365561cc0fd422128e1a3e8/cypress.tgz

Please sign in to comment.