Skip to content

Commit

Permalink
Merge pull request #268 from caijw/cjw-alpha-feat
Browse files Browse the repository at this point in the history
feat: add a function to judege a uin is alpha or not
  • Loading branch information
huangyoukun authored Oct 15, 2018
2 parents 31f08bb + 192fd21 commit 4e934b0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
19 changes: 19 additions & 0 deletions bin/tsw/util/auto-report/alpha.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,25 @@ this.isAlpha = function(req) {
return uinMap[uin] || TSW.getAlphaUinMapSync()[uin];
};

this.isAlphaUin = function (uin) {
if(!uin){
return false;
}
const TSW = require('api/keyman');
const config = require('config');

if (uin && isWin32Like) {
// windows 抓包用
if (config.skyMode) {
return true;
}
}

const uinMap = global[__filename] || {};

return uinMap[uin] || TSW.getAlphaUinMapSync()[uin];
};

this.getUin = function(req) {
const config = require('config');

Expand Down
14 changes: 14 additions & 0 deletions test/bin/tsw/util/alpha.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ describe('test tsw/util/alpha', () => {
});
});

describe('#isAlphaUin', () => {

it('#without uin', () => {
expect(alpha.isAlphaUin()).to.be.equal(false);
});

it('#update', () => {
alpha.update({ 1: true });
const uid = 1;
expect(alpha.isAlphaUin(uid)).to.be.equal(true);
});
});


describe('#getUin', () => {
it('#without req', () => {
expect(alpha.getUin()).to.be.equal(undefined);
Expand Down

0 comments on commit 4e934b0

Please sign in to comment.