testFlags.spec.ts 713 B

12345678910111213141516171819202122
  1. // Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. import { waitForTimeout } from '@tests/support/utils'
  3. import testFlags from '../testFlags'
  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. })