ahbeng/NUSMods

View on GitHub
website/src/selectors/moduleBank.test.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { getModuleCondensed } from 'selectors/moduleBank';

describe(getModuleCondensed.name, () => {
  test('should return a function that determines if the given module code is valid', () => {
    const state: any = {
      moduleBank: {
        moduleCodes: {
          CS1010S: {},
        },
      },
    };

    const checker = getModuleCondensed(state);
    expect(checker).toBeInstanceOf(Function);

    expect(checker('CS1010S')).toBeTruthy();
    expect(checker('ACC1000')).toBeFalsy();
  });
});