configStore.spec.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import ConfigStore from 'sentry/stores/configStore';
  2. import type {Config} from 'sentry/types/system';
  3. describe('ConfigStore', () => {
  4. let configState: Config;
  5. beforeEach(() => {
  6. configState = ConfigStore.getState();
  7. });
  8. afterEach(() => {
  9. ConfigStore.loadInitialData(configState);
  10. });
  11. it('should have regionUrl and organizationUrl', () => {
  12. const links = ConfigStore.get('links');
  13. expect(links).toEqual({
  14. organizationUrl: undefined,
  15. regionUrl: undefined,
  16. sentryUrl: 'https://sentry.io',
  17. });
  18. });
  19. it('should have cookie names', () => {
  20. const csrfCookieName = ConfigStore.get('csrfCookieName');
  21. expect(csrfCookieName).toEqual('csrf-test-cookie');
  22. const superUserCookieName = ConfigStore.get('superUserCookieName');
  23. expect(superUserCookieName).toEqual('su-test-cookie');
  24. });
  25. it('should have customerDomain', () => {
  26. expect(ConfigStore.get('customerDomain')).toEqual(null);
  27. });
  28. it('returns a stable reference from getState()', () => {
  29. ConfigStore.set('theme', 'dark');
  30. const state = ConfigStore.getState();
  31. expect(Object.is(state, ConfigStore.getState())).toBe(true);
  32. });
  33. });