-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from redwoodjs/main
Brining up to speed
- Loading branch information
Showing
63 changed files
with
1,094 additions
and
669 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "0.19.1", | ||
"version": "0.19.2", | ||
"npmClient": "yarn", | ||
"useWorkspaces": true, | ||
"command": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@redwoodjs/auth", | ||
"version": "0.19.1", | ||
"version": "0.19.2", | ||
"files": [ | ||
"dist" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
export const command = 'destroy <type>' | ||
export const aliases = ['d'] | ||
export const description = 'Rollback changes made by the generate command' | ||
import terminalLink from 'terminal-link' | ||
|
||
export const builder = (yargs) => | ||
yargs.commandDir('./destroy', { recurse: true }).demandCommand() | ||
yargs | ||
.commandDir('./destroy', { recurse: true }) | ||
.demandCommand() | ||
.epilogue( | ||
`Also see the ${terminalLink( | ||
'Redwood CLI Reference', | ||
'https://redwoodjs.com/reference/command-line-interface#destroy' | ||
)}` | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 42 additions & 4 deletions
46
packages/cli/src/commands/generate/auth/__tests__/auth.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,46 @@ | ||
global.__dirname = __dirname | ||
// import { loadGeneratorFixture } from 'src/lib/test' | ||
|
||
// import * as auth from '../auth' | ||
import { | ||
waitFor, | ||
} from '@testing-library/react' | ||
|
||
test('true', () => { | ||
expect(true).toEqual(true) | ||
jest.mock('fs') | ||
jest.mock('src/lib', () => ({ | ||
getPaths: () => ({ | ||
api: { functions: '', src: '', lib: '' }, | ||
web: { src: '' }, | ||
}), | ||
})) | ||
|
||
import fs from 'fs' | ||
import chalk from 'chalk' | ||
|
||
import * as auth from '../auth' | ||
|
||
const EXISTING_AUTH_PROVIDER_ERROR = 'Existing auth provider found.\nUse --force to override existing provider.'; | ||
|
||
test(`no error thrown when auth provider not found`, async () => { | ||
// Mock process.exit to make sure CLI quites | ||
const cSpy = jest.spyOn(console, 'log').mockImplementation(() => {}) | ||
|
||
auth.handler({ provider: 'netlify' }) | ||
await waitFor(() => expect(console.log).toHaveBeenCalledTimes(1)) | ||
expect(console.log).not.toHaveBeenCalledWith(chalk.bold.red(EXISTING_AUTH_PROVIDER_ERROR)) | ||
|
||
// Restore mocks | ||
cSpy.mockRestore() | ||
}) | ||
|
||
test('throws an error if auth provider exists', async () => { | ||
// Mock process.exit to make sure CLI quites | ||
const fsSpy = jest.spyOn(fs, 'readFileSync').mockImplementation(() => `import { AuthProvider } from '@redwoodjs/auth'`) | ||
const cSpy = jest.spyOn(console, 'log').mockImplementation(() => {}) | ||
|
||
auth.handler({ provider: 'netlify' }) | ||
await waitFor(() => expect(console.log).toHaveBeenCalledTimes(1)) | ||
expect(console.log).toHaveBeenCalledWith(chalk.bold.red(EXISTING_AUTH_PROVIDER_ERROR)) | ||
|
||
// Restore mocks | ||
fsSpy.mockRestore() | ||
cSpy.mockRestore() | ||
}) |
Oops, something went wrong.