XasCode/terrafile-backend-lib

View on GitHub
__tests__/testUtils/testFilter.ts

Summary

Maintainability
A
0 mins
Test Coverage
type FilteredTest = {
  message: string;
  test: string;
};

type FilteredTests = {
  filtered: FilteredTest[];
};

const ignoreStrings = [`backend.unmocked.spec.ts`];

module.exports = async function filter(tests: string[]): Promise<FilteredTests> {
  return Promise.resolve({
    filtered: tests
      .filter((test) => {
        return ignoreStrings.reduce((acc, curr) => {
          return acc && test.indexOf(curr) === -1;
        }, true);
      })
      .map((filterMatch) => {
        return { message: `skipping...`, test: filterMatch };
      }),
  });
};