-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
__tests__/command_helpers/__snapshots__/findPluginInfo.ts.snap
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`findPluginInfo Function can find plugins 1`] = ` | ||
Object { | ||
"plugin": Object { | ||
"check": [Function], | ||
"report": [Function], | ||
"snapshot": [Function], | ||
}, | ||
"success": true, | ||
} | ||
`; |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const findPluginInfo = require('../../src/extensions/functions/findPluginInfo') | ||
const examplePlugin = require('examplePlugin') | ||
const mockContext = examplePlugin(require('mockContext')) | ||
|
||
describe('findPluginInfo Function', () => { | ||
test('can fail to find plugins', () => { | ||
const rule = { | ||
rule: 'custom', | ||
plugin: 'FAKE', | ||
name: 'checkThing' | ||
} | ||
const customPluginRule = findPluginInfo(rule, mockContext) | ||
expect(customPluginRule).toEqual({ message: "Plugin not found 'FAKE'", success: false }) | ||
} | ||
|
||
test('can fail to find plugins', () => { | ||
const rule = { | ||
rule: 'custom', | ||
plugin: 'Example Plugin', | ||
name: 'FAKE' | ||
} | ||
const customPluginRule = findPluginInfo(rule, mockContext) | ||
expect(customPluginRule.message).toEqual("NOT FOUND: Custom rule from 'Example Plugin' plugin with check function 'FAKE'") | ||
expect(customPluginRule.success).toBeFalsy() | ||
} | ||
|
||
test('can find plugins', () => { | ||
const rule = { | ||
rule: 'custom', | ||
plugin: 'Example Plugin', | ||
name: 'checkThing' | ||
} | ||
const customPluginRule = findPluginInfo(rule, mockContext) | ||
expect(customPluginRule.success).toBeTruthy() | ||
expect(customPluginRule).toMatchSnapshot() | ||
} | ||
}) |