Skip to content

Commit

Permalink
Refactor(codemods): Introduce testTransform utility
Browse files Browse the repository at this point in the history
  * making it DRY
  • Loading branch information
literat committed Mar 15, 2024
1 parent 6f2c5e6 commit a554ce7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// eslint-disable-next-line import/extensions
const { defineTest } = require('jscodeshift/dist/testUtils');
import { testTransform } from '../../../../../tests/testUtils';

defineTest(__dirname, 'fileuploader-prop-names', null, 'fileuploader-prop-names', {
parser: 'tsx',
fixture: 'input',
snapshot: true,
});
testTransform(__dirname, 'fileuploader-prop-names');
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// eslint-disable-next-line import/extensions
const { defineTest } = require('jscodeshift/dist/testUtils');
import { testTransform } from '../../../../../tests/testUtils';

defineTest(__dirname, 'modal-isexpandedonmobile-prop', null, 'modal-isexpandedonmobile-prop', {
parser: 'tsx',
fixture: 'input',
snapshot: true,
});
testTransform(__dirname, 'modal-isexpandedonmobile-prop');
10 changes: 10 additions & 0 deletions packages/codemods/tests/testUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// eslint-disable-next-line import/extensions
const { defineTest } = require('jscodeshift/dist/testUtils');

export const testTransform = (directory: string, name: string) => {
defineTest(directory, name, null, name, {
parser: 'tsx',
fixture: 'input',
snapshot: true,
});
};

0 comments on commit a554ce7

Please sign in to comment.