Skip to content

Commit

Permalink
fix: hackernews-datahub remove egg-datahub (#90)
Browse files Browse the repository at this point in the history
<!--
Thank you for your pull request. Please review below requirements.
Bug fixes and new features should include tests and possibly benchmarks.
Contributors guide: https://github.com/eggjs/egg/blob/master/CONTRIBUTING.md

感谢您贡献代码。请确认下列 checklist 的完成情况。
Bug 修复和新功能必须包含测试,必要时请附上性能测试。
Contributors guide: https://github.com/eggjs/egg/blob/master/CONTRIBUTING.md
-->

##### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [x] `npm test` passes
- [ x] tests and/or benchmarks are included
- [ x] documentation is changed or added
- [ x] commit message follows commit guidelines

##### Affected core subsystem(s)
<!-- Provide affected core subsystem(s). -->

remove `egg-datahub` from `hackernews-datahub`
  • Loading branch information
zivyangll authored and popomore committed Nov 19, 2018
1 parent b17d146 commit c9a8b9c
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 22 deletions.
1 change: 1 addition & 0 deletions hackernews-datahub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ $ npm run test
## E2E Test

```bash
$ npm run datahub
$ npm run dev:e2e
$ npm run test:e2e
```
Expand Down
10 changes: 2 additions & 8 deletions hackernews-datahub/config/config.default.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const fs = require('fs');
const path = require('path');
const datahubConfig = require('../macaca-datahub.config');

module.exports = appInfo => {
const config = {};
Expand All @@ -13,7 +14,7 @@ module.exports = appInfo => {
'/favicon.ico': fs.readFileSync(path.join(appInfo.baseDir, 'app/public/favicon.png')),
};

const mockPort = 5678;
const mockPort = datahubConfig.port;
const hubName = 'hackernews';

config.news = {
Expand All @@ -31,13 +32,6 @@ module.exports = appInfo => {
},
};

// https://github.com/macacajs/macaca-datahub#configuration

config.datahub = {
port: mockPort,
store: path.resolve(__dirname, '..', 'data'),
};

return config;
};

5 changes: 0 additions & 5 deletions hackernews-datahub/config/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,3 @@ exports.nunjucks = {
package: 'egg-view-nunjucks',
};

exports.datahub = {
enable: true,
package: 'egg-datahub',
};

9 changes: 9 additions & 0 deletions hackernews-datahub/macaca-datahub.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

const path = require('path');

module.exports = {
mode: 'local',
port: 5678, // must be 5678, same with datahub-nodejs-sdk's default port
store: path.resolve(__dirname, 'data'),
};
3 changes: 2 additions & 1 deletion hackernews-datahub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
"chai": "^4.1.2",
"cross-env": "^5.1.5",
"egg-bin": "^4.3.5",
"egg-datahub": "2",
"egg-mock": "^3.13.1",
"eslint": "^4.12.0",
"eslint-config-egg": "^5.1.1",
"macaca-cli": "^2.1.2",
"macaca-datahub": "^2.3.5",
"macaca-electron": "2",
"macaca-wd": "2"
},
Expand All @@ -31,6 +31,7 @@
"scripts": {
"dev": "egg-bin dev",
"test": "egg-bin test test/unittest",
"datahub": "datahub server -c macaca-datahub.config.js --verbose",
"dev:e2e": "cross-env NODE_ENV=test MOCK=true egg-bin dev",
"test:e2e": "cross-env NODE_ENV=test macaca run --f_options '--opts test/e2e/mocha.opts' -d ./test/e2e",
"cov": "egg-bin cov",
Expand Down
17 changes: 9 additions & 8 deletions hackernews-datahub/test/e2e/datahub.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe('test/datahub.test.js', () => {

afterEach(function() {
return driver
.coverage()
.saveScreenshots(this);
});

Expand All @@ -44,8 +45,8 @@ describe('test/datahub.test.js', () => {
scene: 'default',
})
.getUrl(BASE_URL)
.sleep(1000)
.hasText('#wrapper > div.news-view.view.v-transition > div:nth-child(10) > span', '10');
.elementByCss('#wrapper > div.news-view.view.v-transition > div:nth-child(10) > span')
.hasText('10');
});

it('list20 render should be ok', async function() {
Expand All @@ -56,8 +57,8 @@ describe('test/datahub.test.js', () => {
scene: 'list20',
})
.getUrl(BASE_URL)
.sleep(1000)
.hasText('#wrapper > div.news-view.view.v-transition > div:nth-child(20) > span', '20');
.elementByCss('#wrapper > div.news-view.view.v-transition > div:nth-child(20) > span')
.hasText('20');
});

it('list5 render should be ok', async function() {
Expand All @@ -68,8 +69,8 @@ describe('test/datahub.test.js', () => {
scene: 'list5',
})
.getUrl(BASE_URL)
.sleep(1000)
.hasText('#wrapper > div.news-view.view.v-transition > div:nth-child(5) > span', '5');
.elementByCss('#wrapper > div.news-view.view.v-transition > div:nth-child(5) > span')
.hasText('5');
});

it('list0 render should be empty', async function() {
Expand All @@ -80,8 +81,8 @@ describe('test/datahub.test.js', () => {
scene: 'empty',
})
.getUrl(BASE_URL)
.sleep(1000)
.hasText('#wrapper > div.news-view.view.v-transition > p', 'empty');
.elementByCss('#wrapper > div.news-view.view.v-transition > p')
.hasText('empty');
});
});
});
Expand Down

0 comments on commit c9a8b9c

Please sign in to comment.