Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sharding-ui-frontend add unit test #3039

Merged
merged 10 commits into from
Sep 18, 2019
Merged

sharding-ui-frontend add unit test #3039

merged 10 commits into from
Sep 18, 2019

Conversation

wqzwh
Copy link
Contributor

@wqzwh wqzwh commented Sep 15, 2019

Fixes #3038 .

sharding-ui-frontend add unit test

  • componet unit test
  • pages unit test

add packages:

  • "karma": "^4.3.0"
  • "karma-chai": "^0.1.0"
  • "karma-chrome-launcher": "^3.1.0"
  • "karma-coverage": "^2.0.1"
  • "karma-mocha": "^1.3.0"
  • "karma-sourcemap-loader": "^0.3.7"
  • "karma-spec-reporter": "0.0.32"
  • "karma-webpack": "^4.0.2"
  • "@babel/core": "^7.6.0"
  • "@babel/plugin-syntax-dynamic-import": "^7.2.0"
  • "@babel/plugin-transform-runtime": "^7.6.0"
  • "@babel/preset-env": "^7.6.0"
  • "@babel/runtime": "^7.6.0"
  • "@vue/test-utils": "^1.0.0-beta.29"
  • "chai": "^4.2.0"
  • "mocha": "^6.2.0"
# unit test
npm run unit

@coveralls
Copy link

coveralls commented Sep 15, 2019

Pull Request Test Coverage Report for Build 366

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 246 unchanged lines in 41 files lost coverage.
  • Overall coverage increased (+0.4%) to 64.335%

Files with Coverage Reduction New Missed Lines %
sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/encrypt/engine/dml/EncryptInsertOptimizeEngine.java 1 91.67%
sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/encrypt/statement/EncryptInsertOptimizedStatement.java 1 85.71%
sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/sharding/engnie/dml/ShardingUpdateOptimizeEngine.java 1 90.0%
sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/sharding/segment/condition/ShardingCondition.java 1 75.0%
sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/sharding/statement/dml/ShardingConditionOptimizedStatement.java 1 83.33%
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/sql/statement/dml/InsertStatement.java 1 96.97%
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/generator/InsertCipherNameTokenGenerator.java 1 93.75%
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/generator/InsertSetQueryAndPlainColumnsTokenGenerator.java 1 97.06%
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/generator/SelectItemsTokenGenerator.java 1 95.0%
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/generator/UpdateEncryptColumnTokenGenerator.java 1 96.88%
Totals Coverage Status
Change from base Build 353: 0.4%
Covered Lines: 9472
Relevant Lines: 14723

💛 - Coveralls

@beckhampu beckhampu self-assigned this Sep 15, 2019
Copy link
Contributor

@beckhampu beckhampu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wqzwh, Good PR ! I noticed that you used karma for js unit testing . I think you should update the readme file .

@@ -9,7 +9,8 @@
"start": "npm run dev",
"lint": "eslint --ext .js,.vue src",
"test": "cross-env NODE_ENV=mock webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"build": "node build/build.js"
"build": "node build/build.js",
"unit": "cross-env BABEL_ENV=test karma start --single-run"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wqzwh ,now we use karma,can we remove the easy-mock?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Es-mock is suitable for use in the early stages of development, but can not be used for the time being, so this iteration has been deleted.

Karma does unit testing for components and pages

</el-aside>
<el-container>
<el-header style="padding: 0">
<s-head @on-togger="onTogger"/>
<s-head class="s-head" @on-togger="onTogger" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wqzwh, maybe we need to improve the configuration of eslint to prevent useless format.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add eslint rules,solve the problem of adding self-closing tags,the snippet code is as follows:

"vue/html-self-closing": ["error", {
      "html": {
        "void": "any",
        "normal": "any",
        "component": "any"
      },
      "svg": "any",
      "math": "any"
    }]

@@ -18,8 +18,8 @@
<template>
<div class="s-pro-components-sider-menu-index-logo">
<a href="/">
<img class src="../../assets/img/sidebar-logo.png" alt="logo">
<img class="collapse-logo" src="../../assets/img/logo.png" alt="logo">
<img src="../../assets/img/sidebar-logo.png" alt="logo" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<img src="../../assets/img/sidebar-logo.png" alt="logo" />
<img src="../../assets/img/sidebar-logo.png" alt="logo" >

Here is eslint error: Disallow self-closing on HTML void elements.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add eslint rules,solve the problem of adding self-closing tags,the snippet code is as follows:

"vue/html-self-closing": ["error", {
      "html": {
        "void": "any",
        "normal": "any",
        "component": "any"
      },
      "svg": "any",
      "math": "any"
    }]

1. Extending eslint rules
2. Delete easymock-related configuration
3. Modify node version requirements in package.json
4. Update Readme
@wqzwh
Copy link
Contributor Author

wqzwh commented Sep 17, 2019

@beckhampu Details are revised as follows:

  1. Extending eslint rules
  2. Delete easymock-related configuration
  3. Modify node version requirements in package.json
  4. Update Readme

@beckhampu
Copy link
Contributor

@wqzwh , build failure. You change the node version in file package.json, so you need to change it for frontend-maven-plugin.

@wqzwh
Copy link
Contributor Author

wqzwh commented Sep 18, 2019

@wqzwh , build failure. You change the node version in file package.json, so you need to change it for frontend-maven-plugin.

ok

@beckhampu
Copy link
Contributor

@terrymanu ,it's alright now. This pr can be merged.

@terrymanu terrymanu merged commit 3e1d417 into apache:dev Sep 18, 2019
@terrymanu terrymanu added this to the 4.0.0-RC3 milestone Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sharding-ui-frontend add unit test
4 participants