Skip to content

Commit

Permalink
make tests pass
Browse files Browse the repository at this point in the history
implementation works individually for each of the three test cases. I don't like breaking them into three separate E2E tests, but I'm unsure how to orchestrate them properly otherwise.
  • Loading branch information
andrew-codes committed Dec 12, 2019
1 parent ffa2aca commit 98320cf
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 deletions packages/desktop-gui/cypress/integration/settings_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,32 +183,31 @@ describe('Settings', () => {
})
})

it('displays null when no env settings are found', function () {
const setConfigEnv = (config, v) => {
return flow([
merge(config),
set('resolved.env', v),
])({})
}
it('displays null when no env settings are null', function () {
this.ipc.openProject
.onCall(0).resolves(setConfigEnv(this.config, null))

this.ipc.onConfigChanged.yield()

cy.contains('.line', 'env:null')
})

it('displays null when no env settings are undefined', function () {
this.ipc.openProject
.onCall(1).resolves(setConfigEnv(this.config, null))
.onCall(3).resolves(setConfigEnv(this.config, undefined))
.onCall(2).resolves(setConfigEnv(this.config, {}))
.onCall(0).resolves(setConfigEnv(this.config, undefined))

this.ipc.onConfigChanged.yield()

cy.contains('.line', 'env:null')
.then(() => {
this.ipc.onConfigChanged.yield()
})

cy.contains('.line', 'env:null')
.then(() => {
this.ipc.onConfigChanged.yield()
it('displays null when no env settings are empty', function () {
this.ipc.openProject
.onCall(0).resolves(setConfigEnv(this.config, {}))

cy.contains('.line', 'env:null')
})
})
this.ipc.onConfigChanged.yield()

cy.contains('.line', 'env:null')
})

it('displays env settings', () => {
Expand Down Expand Up @@ -597,3 +596,11 @@ describe('Settings', () => {
})
})
})

// --
function setConfigEnv (config, v) {
return flow([
merge(config),
set('resolved.env', v),
])({})
}

0 comments on commit 98320cf

Please sign in to comment.