Skip to content

Commit

Permalink
Remove leading forward slash from test names
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaemami59 committed Jan 16, 2024
1 parent 0f065ec commit 2837b25
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions packages/rtk-codemods/transformTestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ export const runTransformTest = (
describe(name, () => {
globbySync('**/*.input.*', {
cwd: fixturePath,
absolute: true
absolute: true,
objectMode: true
})
.map((entry) => entry.slice(fixturePath.length))
.map((entry) => entry.name)
.forEach((filename) => {
const extension = path.extname(filename)
const testName = filename.replace(`.input${extension}`, '')
Expand All @@ -31,16 +32,20 @@ export const runTransformTest = (
`${testName}.output${extension}`
)

describe(testName, () => {
const inputFileContent = fs.readFileSync(inputPath, 'utf8')

const expectedOutput = fs.readFileSync(outputPath, 'utf8')

describe(`${testName}${extension}`, () => {
it('transforms correctly', () => {
runInlineTest(
transform,
{},
{
path: testInputPath,
source: fs.readFileSync(inputPath, 'utf8')
source: inputFileContent
},
fs.readFileSync(outputPath, 'utf8'),
expectedOutput,
{ parser }
)
})
Expand All @@ -51,9 +56,9 @@ export const runTransformTest = (
{},
{
path: testInputPath,
source: fs.readFileSync(outputPath, 'utf8')
source: inputFileContent
},
fs.readFileSync(outputPath, 'utf8'),
expectedOutput,
{ parser }
)
})
Expand Down

0 comments on commit 2837b25

Please sign in to comment.