chore: Fix integration test edge cases in suggestionsBrowserKey
This commit is contained in:
parent
661bcdda08
commit
9b1b72773d
|
|
@ -339,8 +339,8 @@ function saveBrowserSuggestions() {
|
|||
if (arg.suggestionsBrowserKey) {
|
||||
const value = argValues.value[arg.name]
|
||||
|
||||
// Only save non-empty values for non-checkbox/confirmation types
|
||||
if (value && value !== '' && arg.type !== 'checkbox' && arg.type !== 'confirmation') {
|
||||
// Only save non-empty values for non-checkbox/confirmation/password types
|
||||
if (value && value !== '' && arg.type !== 'checkbox' && arg.type !== 'confirmation' && arg.type !== 'password') {
|
||||
try {
|
||||
const key = `olivetin-suggestions-${arg.suggestionsBrowserKey}`
|
||||
const stored = localStorage.getItem(key)
|
||||
|
|
|
|||
|
|
@ -222,10 +222,15 @@ describe('config: suggestionsBrowserKey', function () {
|
|||
await waitForLogsPage()
|
||||
await waitForExecutionComplete()
|
||||
|
||||
// Verify empty value was not saved - localStorage should be null or not contain the key
|
||||
// Verify empty value was not saved - localStorage should be null or empty-equivalent
|
||||
const stored = await getLocalStorageItem('olivetin-suggestions-test-suggestions-key')
|
||||
// Should be null since empty values are not saved
|
||||
expect(stored).to.be.null
|
||||
// Should be null OR empty JSON array string ("[]") OR parse to empty array
|
||||
if (stored !== null) {
|
||||
const suggestions = JSON.parse(stored)
|
||||
expect(suggestions).to.be.an('array')
|
||||
expect(suggestions).to.have.length(0)
|
||||
}
|
||||
// If stored is null, that's also acceptable - no assertion needed
|
||||
})
|
||||
|
||||
it('Suggestions are shared across inputs with the same suggestionsBrowserKey', async function () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue