Skip to content

Commit

Permalink
Merge pull request #864 from CMSgov/QPPA-9642
Browse files Browse the repository at this point in the history
QPPA-9642: fix enum typing
  • Loading branch information
ckawell-sb authored Dec 4, 2024
2 parents e51c254 + 9bb7b9f commit d5f4f4b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 12 additions & 1 deletion index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import fse from 'fs-extra';
import { vol } from 'memfs';
import path from 'path';
import YAML from 'yaml';
import * as programNamesJson from './util/program-names/program-names.json';

import * as programNamesJson from './util/program-names/program-names.json';
import * as index from './index';
import { Constants } from './constants';
import * as mvpDataUtils from './util/mvp-data-utils';
import { ProgramNamesEnum } from './util/interfaces/program-names';

const mvpJson = [
{
Expand Down Expand Up @@ -727,4 +728,14 @@ describe('index', () => {
]);
})
})

describe('ProgramNames Enum', () => {
it('checks that the ProgramNames enum matches the json object of the same values.', () => {
const jsonValues = Object.values(programNamesJson)
.filter(val => typeof val === 'string');
const enumValues = Object.values(ProgramNamesEnum);

expect(jsonValues).toStrictEqual(enumValues);
})
})
});
4 changes: 2 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ export function getProgramNames(): ProgramNames {

/**
*
* @return {ProgramNames} - program names -
* @return {typeof ProgramNamesEnum} - program names -
* An Enum containing all program names.
* This is an "all-encompassing" list containing past and present program-name values.
* IE, this enum is not performance-year conscious.
*/
export function getProgramNamesEnum(): ProgramNames {
export function getProgramNamesEnum(): typeof ProgramNamesEnum {
return ProgramNamesEnum;
}

Expand Down

0 comments on commit d5f4f4b

Please sign in to comment.