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 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a basic suite of specs to ensure the package is minimally working.
- Loading branch information
1 parent
804ffa5
commit 2efb3f9
Showing
5 changed files
with
95 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"globals": { | ||
"waitsForPromise": true | ||
}, | ||
"env": { | ||
"jasmine": 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 @@ | ||
asfd |
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 @@ | ||
"""Simple test file.""" |
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,66 @@ | ||
'use babel'; | ||
|
||
describe('The flake8 provider for Linter', () => { | ||
const lint = require('../lib/main').provideLinter().lint; | ||
|
||
beforeEach(() => { | ||
waitsForPromise(() => { | ||
return Promise.all([ | ||
atom.packages.activatePackage('linter-flake8'), | ||
atom.packages.activatePackage('language-python').then(() => | ||
atom.workspace.open(__dirname + '/fixtures/good.py') | ||
) | ||
]); | ||
}); | ||
}); | ||
|
||
it('should be in the packages list', () => { | ||
return expect(atom.packages.isPackageLoaded('linter-flake8')).toBe(true); | ||
}); | ||
|
||
it('should be an active package', () => { | ||
return expect(atom.packages.isPackageActive('linter-flake8')).toBe(true); | ||
}); | ||
|
||
describe('checks bad.py and', () => { | ||
let editor = null; | ||
beforeEach(() => { | ||
waitsForPromise(() => { | ||
return atom.workspace.open(__dirname + '/fixtures/bad.py').then(openEditor => { | ||
editor = openEditor; | ||
}); | ||
}); | ||
}); | ||
|
||
it('finds at least one message', () => { | ||
return lint(editor).then(messages => { | ||
expect(messages.length).toBeGreaterThan(0); | ||
}); | ||
}); | ||
|
||
it('verifies that message', () => { | ||
return lint(editor).then(messages => { | ||
expect(messages[0].type).toBeDefined(); | ||
expect(messages[0].type).toEqual('Warning'); | ||
expect(messages[0].html).not.toBeDefined(); | ||
expect(messages[0].text).toBeDefined(); | ||
expect(messages[0].text).toEqual('D100 — Missing docstring in public module'); | ||
expect(messages[0].filePath).toBeDefined(); | ||
expect(messages[0].filePath).toMatch(/.+spec[\\\/]fixtures[\\\/]bad\.py$/); | ||
expect(messages[0].range).toBeDefined(); | ||
expect(messages[0].range.length).toEqual(2); | ||
expect(messages[0].range).toEqual([[0, 0], [0, 1]]); | ||
}); | ||
}); | ||
}); | ||
|
||
it('finds nothing wrong with a valid file', () => { | ||
waitsForPromise(() => { | ||
return atom.workspace.open(__dirname + '/fixtures/good.py').then(editor => { | ||
return lint(editor).then(messages => { | ||
expect(messages.length).toEqual(0); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |