Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@doodle/components / src / components / utils / user.test.js
Size: Mime:
import { isOrgAdmin } from './user';

describe('user.isOrgAdmin', () => {
  it('should return true if user.data.premium.active.organisationAdmin is set', () => {
    expect(
      isOrgAdmin({
        data: { premium: { active: { organisationAdmin: true } } },
      })
    ).toEqual(true);
  });

  it('should return false if user.data.premium.active.organisationAdmin is not set', () => {
    expect(
      isOrgAdmin({
        data: { premium: { active: undefined } },
      })
    ).toEqual(false);
  });

  it('should return false if user is not set', () => {
    expect(isOrgAdmin(undefined)).toEqual(false);
  });

  it('should return true if isAdmin is set', () => {
    expect(
      isOrgAdmin({
        isAdmin: true,
        data: { premium: { active: undefined } },
      })
    ).toEqual(true);
  });

  it('should return false if isAdmin is not set', () => {
    expect(
      isOrgAdmin({
        isAdmin: undefined,
        data: { premium: { active: undefined } },
      })
    ).toEqual(false);
  });
});