Skip to content

Commit 63b5b32

Browse files
committed
remove old magic redirect codemod
1 parent ced14f3 commit 63b5b32

File tree

9 files changed

+14
-159
lines changed

9 files changed

+14
-159
lines changed

commands/__test__/transform.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ describe('interactive mode', () => {
2222
it('runs without codemodName and source params provided', async () => {
2323
const spyOnConsole = jest.spyOn(console, 'log').mockImplementation()
2424

25-
prompts.inject(['magic-redirect'])
25+
prompts.inject(['pluralized-methods'])
2626
prompts.inject(['./transforms/__testfixtures__'])
2727

2828
await transform(undefined, undefined, defaultOptions)
2929

3030
expect(spyOnConsole).not.toHaveBeenCalled()
3131
expect(run).toHaveBeenCalledTimes(1)
3232
expect(run).toHaveBeenCalledWith(
33-
expect.stringContaining(getSystemPath('/transforms/magic-redirect.js')),
33+
expect.stringContaining(getSystemPath('/transforms/pluralized-methods.js')),
3434
expect.arrayContaining([expect.stringContaining(getSystemPath('/transforms/__testfixtures__'))]),
3535
{
3636
babel: false,
@@ -46,14 +46,14 @@ describe('interactive mode', () => {
4646
it('runs properly on incorrect user input', async () => {
4747
const spyOnConsole = jest.spyOn(console, 'log').mockImplementation()
4848

49-
prompts.inject(['magic-redirect'])
49+
prompts.inject(['pluralized-methods'])
5050

5151
await transform('bad-codemod', './transforms/__testfixtures__', defaultOptions)
5252

5353
expect(spyOnConsole).not.toHaveBeenCalled()
5454
expect(run).toHaveBeenCalledTimes(1)
5555
expect(run).toHaveBeenCalledWith(
56-
expect.stringContaining(getSystemPath('/transforms/magic-redirect.js')),
56+
expect.stringContaining(getSystemPath('/transforms/pluralized-methods.js')),
5757
expect.arrayContaining([expect.stringContaining(getSystemPath('/transforms/__testfixtures__'))]),
5858
{
5959
babel: false,
@@ -71,12 +71,12 @@ describe('interactive mode', () => {
7171

7272
prompts.inject(['__testfixtures__'])
7373

74-
await transform('magic-redirect', undefined, defaultOptions)
74+
await transform('pluralized-methods', undefined, defaultOptions)
7575

7676
expect(spyOnConsole).not.toHaveBeenCalled()
7777
expect(run).toHaveBeenCalledTimes(1)
7878
expect(run).toHaveBeenCalledWith(
79-
expect.stringContaining(getSystemPath('/transforms/magic-redirect.js')),
79+
expect.stringContaining(getSystemPath('/transforms/pluralized-methods.js')),
8080
expect.arrayContaining([expect.stringContaining('__testfixtures__')]),
8181
{
8282
babel: false,
@@ -98,12 +98,12 @@ describe('Non-Interactive Mode', () => {
9898
it('Transforms code with codemodName and source params provided', async () => {
9999
const spyOnConsole = jest.spyOn(console, 'log').mockImplementation()
100100

101-
await transform('magic-redirect', '__testfixtures__', defaultOptions)
101+
await transform('pluralized-methods', '__testfixtures__', defaultOptions)
102102

103103
expect(spyOnConsole).not.toHaveBeenCalled()
104104
expect(run).toHaveBeenCalledTimes(1)
105105
expect(run).toHaveBeenCalledWith(
106-
expect.stringContaining(getSystemPath('/transforms/magic-redirect.js')),
106+
expect.stringContaining(getSystemPath('/transforms/pluralized-methods.js')),
107107
expect.arrayContaining([expect.stringContaining('__testfixtures__')]),
108108
{
109109
babel: false,

commands/__test__/upgrade.spec.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('interactive mode', () => {
1414
it('runs without source params provided and select is true', async () => {
1515
const spyOnConsole = jest.spyOn(console, 'log').mockImplementation()
1616

17-
prompts.inject([['magic-redirect', 'req-param']])
17+
prompts.inject([['pluralized-methods', 'req-param']])
1818

1919
await upgrade('__testfixtures__', { select: true })
2020

@@ -26,7 +26,7 @@ describe('interactive mode', () => {
2626
it('runs with source params provided and select is true', async () => {
2727
const spyOnConsole = jest.spyOn(console, 'log').mockImplementation()
2828

29-
prompts.inject([['magic-redirect', 'req-param']])
29+
prompts.inject([['pluralized-methods', 'req-param']])
3030

3131
await upgrade('__testfixtures__', { select: true })
3232

@@ -43,8 +43,8 @@ describe('interactive mode', () => {
4343
await upgrade(undefined)
4444

4545
expect(spyOnConsole).toHaveBeenCalled()
46-
expect(spyOnConsole).toHaveBeenCalledTimes(5)
47-
expect(run).toHaveBeenCalledTimes(4)
46+
expect(spyOnConsole).toHaveBeenCalledTimes(4)
47+
expect(run).toHaveBeenCalledTimes(3)
4848
})
4949
})
5050

@@ -58,12 +58,11 @@ describe('Non-Interactive Mode', () => {
5858

5959
await upgrade('__testfixtures__')
6060

61-
expect(spyOnConsole).toHaveBeenCalledTimes(5)
62-
expect(spyOnConsole).toHaveBeenCalledWith('> Applying codemod: magic-redirect')
61+
expect(spyOnConsole).toHaveBeenCalledTimes(4)
6362
expect(spyOnConsole).toHaveBeenCalledWith('> Applying codemod: pluralized-methods')
6463
expect(spyOnConsole).toHaveBeenCalledWith('> Applying codemod: req-param')
6564
expect(spyOnConsole).toHaveBeenCalledWith('> Applying codemod: v4-deprecated-signatures')
6665
expect(spyOnConsole).toHaveBeenLastCalledWith('\n> All codemods have been applied successfully. \n')
67-
expect(run).toHaveBeenCalledTimes(4)
66+
expect(run).toHaveBeenCalledTimes(3)
6867
})
6968
})

config.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
export const TRANSFORM_OPTIONS = [
2-
{
3-
description: 'Transform the deprecated magic string "back"',
4-
value: 'magic-redirect',
5-
version: '5.0.0',
6-
},
72
{
83
description: 'Transform the methods to their pluralized versions',
94
value: 'pluralized-methods',

transforms/__test__/magic-redirect.spec.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

transforms/__testfixtures__/magic-redirect/location.input.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

transforms/__testfixtures__/magic-redirect/location.output.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

transforms/__testfixtures__/magic-redirect/redirect.input.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

transforms/__testfixtures__/magic-redirect/redirect.output.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

transforms/magic-redirect.ts

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)