-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: adds unit tests, adds pre-push hook, adds test step into CI
- Loading branch information
Davide Gaggero
committed
Nov 4, 2021
1 parent
fc07bc0
commit 0912604
Showing
8 changed files
with
2,093 additions
and
96 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 @@ | ||
yarn test --all --watchAll false |
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,10 @@ | ||
const path = require('path'); | ||
|
||
// This is a custom Jest transformer turning file imports into filenames. | ||
// http://facebook.github.io/jest/docs/tutorial-webpack.html | ||
|
||
module.exports = { | ||
process(src, filename) { | ||
return `module.exports = ${JSON.stringify(path.basename(filename))};`; | ||
}, | ||
} |
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,17 @@ | ||
|
||
import type { Config } from '@jest/types' | ||
import { defaults } from 'jest-config' | ||
|
||
export default async (): Promise<Config.InitialOptions> => { | ||
return { | ||
verbose: true, | ||
preset: 'ts-jest', | ||
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'], | ||
transform: { | ||
"^.+\\.(js|css|png|jpg|jpeg|gif|svg)$": "<rootDir>/config/jest/fileTransform.js" | ||
}, | ||
transformIgnorePatterns: [ | ||
"node_modules/*" | ||
] | ||
} | ||
} |
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,33 @@ | ||
import BeePlugin from './index' | ||
|
||
|
||
describe("BeePlugin", () => { | ||
const beeInstance = new BeePlugin() | ||
test('should test interface', () => { | ||
expect(typeof beeInstance.preview).toBe("function") | ||
expect(typeof beeInstance.reload).toBe("function") | ||
expect(typeof beeInstance.save).toBe("function") | ||
expect(typeof beeInstance.saveAsTemplate).toBe("fusnction") | ||
expect(typeof beeInstance.send).toBe("function") | ||
expect(typeof beeInstance.showComment).toBe("function") | ||
expect(typeof beeInstance.start).toBe("function") | ||
expect(typeof beeInstance.join).toBe("function") | ||
expect(typeof beeInstance.toggleComments).toBe("function") | ||
expect(typeof beeInstance.toggleMergeTagsPreview).toBe("function") | ||
expect(typeof beeInstance.togglePreview).toBe("function") | ||
expect(typeof beeInstance.toggleStructure).toBe("function") | ||
expect(typeof beeInstance.getToken).toBe("function") | ||
expect(typeof beeInstance.load).toBe("function") | ||
expect(typeof beeInstance.loadStageMode).toBe("function") | ||
expect(typeof beeInstance.loadWorkspace).toBe("function") | ||
expect(typeof beeInstance.loadConfig).toBe("function") | ||
}) | ||
|
||
test('should call getToken', () => { | ||
const getTokenSpy = jest.spyOn(beeInstance, "getToken") | ||
|
||
beeInstance.getToken('', '') | ||
expect(getTokenSpy).toHaveBeenCalled() | ||
|
||
}) | ||
}) |
Oops, something went wrong.