Skip to content

Commit

Permalink
add svg module tests
Browse files Browse the repository at this point in the history
  • Loading branch information
silverwind committed Nov 14, 2021
1 parent 46b9a27 commit e6a4733
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
4 changes: 3 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ export default {
testEnvironment: 'jsdom',
testMatch: ['<rootDir>/**/*.test.js'],
testTimeout: 20000,
transform: {},
transform: {
'\\.svg$': 'jest-raw-loader',
},
verbose: false,
};

13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"eslint-plugin-vue": "8.0.3",
"jest": "27.3.1",
"jest-extended": "1.1.0",
"jest-raw-loader": "1.0.1",
"postcss-less": "5.0.0",
"stylelint": "14.0.1",
"stylelint-config-standard": "23.0.0",
Expand Down
9 changes: 9 additions & 0 deletions web_src/js/svg.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {svg, svgNode} from './svg.js';

test('svg', () => {
expect(svg('octicon-repo')).toStartWith('<svg');
});

test('svgNode', () => {
expect(svgNode('octicon-repo')).toBeInstanceOf(Element);
});

0 comments on commit e6a4733

Please sign in to comment.