This repository has been archived by the owner on Aug 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some basic specs ensuring the linter is working. Fixes #37.
- Loading branch information
1 parent
f7e716c
commit 787abf0
Showing
3 changed files
with
57 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
env: { | ||
jasmine: true, | ||
atomtest: true | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
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,51 @@ | ||
'use babel'; | ||
|
||
import * as path from 'path'; | ||
|
||
const cleanPath = path.join(__dirname, 'fixtures', 'test_clean.pp'); | ||
const errorsPath = path.join(__dirname, 'fixtures', 'test_errors.pp'); | ||
|
||
describe('The puppet-lint provider for Linter', () => { | ||
const lint = require(path.join('..', 'lib', 'main.js')).provideLinter().lint; | ||
|
||
beforeEach(() => { | ||
atom.workspace.destroyActivePaneItem(); | ||
|
||
waitsForPromise(() => | ||
Promise.all([ | ||
atom.packages.activatePackage('linter-puppet-lint'), | ||
atom.packages.activatePackage('language-puppet'), | ||
]) | ||
); | ||
}); | ||
|
||
it('finds nothing wrong with a valid file', () => { | ||
waitsForPromise(() => | ||
atom.workspace.open(cleanPath).then(editor => lint(editor)).then((messages) => { | ||
expect(messages.length).toBe(0); | ||
}) | ||
); | ||
}); | ||
|
||
it('handles messages from puppet-lint', () => { | ||
waitsForPromise(() => | ||
atom.workspace.open(errorsPath).then(editor => lint(editor)).then((messages) => { | ||
expect(messages.length).toBe(2); | ||
|
||
expect(messages[0].type).toBe('error'); | ||
expect(messages[0].severity).toBe('error'); | ||
expect(messages[0].html).not.toBeDefined(); | ||
expect(messages[0].text).toBe('does_not::exist not in autoload module layout'); | ||
expect(messages[0].filePath).toBe(errorsPath); | ||
expect(messages[0].range).toEqual([[0, 6], [0, 14]]); | ||
|
||
expect(messages[1].type).toBe('warning'); | ||
expect(messages[1].severity).toBe('warning'); | ||
expect(messages[1].html).not.toBeDefined(); | ||
expect(messages[1].text).toBe('class not documented'); | ||
expect(messages[1].filePath).toBe(errorsPath); | ||
expect(messages[1].range).toEqual([[0, 0], [0, 5]]); | ||
}) | ||
); | ||
}); | ||
}); |