const {
  findCampusByUri,
  findCampusByCampusCode,
  institutionByCampusCode,
  getCampus,
  getMainCampusCode,
  campusCodeToTenantCode,
} = require('./tenants.constant');
const tenants = require('./tenants.constant');

describe('Tenant Constant', () => {
  it('should get campuses for an institution by campuscode', () => {
    expect(institutionByCampusCode('03').length).toEqual(2);
  });

  it('should get campus with name/shortname by campusCode', () => {
    const expected = tenants[0].campusList[3];
    expect(getCampus('03')).toEqual(expected);
  });

  it('should return main campus code for health affiliation campus code', () => {
    expect(getMainCampusCode('03_H')).toEqual('03');
  });

  it('should return campus by campus code', () => {
    expect(findCampusByCampusCode('03').uri).toEqual('urn:mace:incommon:ucdavis.edu');
  });

  it('should return campus by uri', () => {
    expect(findCampusByUri('urn:mace:incommon:ucdavis.edu').campusCode).toEqual('03');
  });

  it('should return tenantCode from campusCode', () => {
    expect(campusCodeToTenantCode('00')).toEqual('UC');
  });
});
