-
Notifications
You must be signed in to change notification settings - Fork 16
DX-1121 - Fixed Oclif test cases #1524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ea5a398
fixed the test cases with oclif/test v4
cs-raj 0bc9f91
fixed entries test cases
cs-raj a86f7b6
fixed other test cases
cs-raj 1470c61
version bump
cs-raj 2046fc1
Merge branch 'development' into fix/DX-1121
cs-raj 3e35482
lockfile fix
cs-raj 39724f3
removed spy
cs-raj da6b2b2
audit version bump to minor version
cs-raj bd21986
Merge branch 'development' into fix/DX-1121
cs-raj c7f9649
PR comment
cs-raj 2fe550c
minor var name change
cs-raj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
28 changes: 14 additions & 14 deletions
28
packages/contentstack-audit/test/unit/commands/index.test.ts
This file contains hidden or 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,46 +1,46 @@ | ||
| import winston from 'winston'; | ||
| import { expect, test as fancy } from '@oclif/test'; | ||
| import { expect } from 'chai'; | ||
| import { runCommand } from '@oclif/test'; | ||
| import { FileTransportInstance } from 'winston/lib/winston/transports'; | ||
|
|
||
| import { AuditBaseCommand } from '../../../src/audit-base-command'; | ||
|
|
||
| import fancy from 'fancy-test'; | ||
|
cs-raj marked this conversation as resolved.
Outdated
|
||
| describe('Audit command', () => { | ||
| const fsTransport = class FsTransport { | ||
| filename!: string; | ||
| } as FileTransportInstance; | ||
|
|
||
| describe('Audit run method', () => { | ||
| const test = fancy.loadConfig({ root: process.cwd() }); | ||
| test | ||
| fancy | ||
| .stdout({ print: process.env.PRINT === 'true' || false }) | ||
| .stub(winston.transports, 'File', () => fsTransport) | ||
| .stub(winston, 'createLogger', () => ({ log: () => {}, error: () => {} })) | ||
| .stub(AuditBaseCommand.prototype, 'start', () => {}) | ||
| .command(['cm:stacks:audit']) | ||
| .it('should trigger AuditBaseCommand start method', ({ stdout }) => { | ||
| .it('should trigger AuditBaseCommand start method', async () => { | ||
| const { stdout } = await runCommand(['cm:stacks:audit'], { root: process.cwd() }); | ||
| expect(stdout).to.be.string; | ||
| }); | ||
|
|
||
| test | ||
| fancy | ||
| .stderr({ print: false }) | ||
| .stdout({ print: process.env.PRINT === 'true' || false }) | ||
| .stub(winston.transports, 'File', () => fsTransport) | ||
| .stub(winston, 'createLogger', () => ({ log: console.log, error: console.error })) | ||
| .stub(AuditBaseCommand.prototype, 'start', () => Promise.reject('process failed')) | ||
| .command(['cm:stacks:audit']) | ||
| .exit(1) | ||
| .it('should log any error and exit with status code 1'); | ||
| .it('should log any error and exit with status code 1', async () => { | ||
| await runCommand(['cm:stacks:audit'], { root: process.cwd() }); | ||
| }); | ||
|
|
||
| test | ||
| fancy | ||
| .stderr({ print: false }) | ||
| .stdout({ print: process.env.PRINT === 'true' || false }) | ||
| .stub(winston.transports, 'File', () => fsTransport) | ||
| .stub(winston, 'createLogger', () => ({ log: console.log, error: console.error })) | ||
| .stub(AuditBaseCommand.prototype, 'start', () => { | ||
| throw Error('process failed'); | ||
| }) | ||
| .command(['cm:stacks:audit']) | ||
| .exit(1) | ||
| .it('should log the error objet message and exit with status code 1'); | ||
| .it('should log the error objet message and exit with status code 1', async () => { | ||
| await runCommand(['cm:stacks:audit'], { root: process.cwd() }); | ||
| }); | ||
| }); | ||
| }); | ||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.