testFlags.spec.ts 720 B

1234567891011121314151617181920212223
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { waitForTimeout } from '#tests/support/utils.ts'
  3. import testFlags from '../testFlags.ts'
  4. describe('TestFlags', () => {
  5. it('handles test flags properly', async () => {
  6. expect.assertions(5)
  7. expect(testFlags.get('not_defined')).toBe(false)
  8. await testFlags.set('defined')
  9. expect(testFlags.get('defined')).toBe(true)
  10. await testFlags.clear('defined')
  11. expect(testFlags.get('defined')).toBe(false)
  12. await testFlags.set('defined')
  13. expect(testFlags.get('defined')).toBe(true)
  14. await waitForTimeout(0)
  15. // Test the clearing side effect of get()
  16. expect(testFlags.get('defined')).toBe(false)
  17. })
  18. })