Skip to content

Commit

Permalink
test: use env variable variables in login.test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
greenhat616 committed Sep 7, 2020
1 parent 9aed821 commit bc71f53
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .github/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
${{ runner.os }}-node-
- run: npm ci
name: Install dependencies
- name: Set Test Env
run: |
export NCM_API_TEST_LOGIN_PHONE=${{ secrets.NCM_API_TEST_LOGIN_PHONE }}
export NCM_API_TEST_LOGIN_PASSWORD=${{ secrets.NCM_API_TEST_LOGIN_PASSWORD }}
- name: Test
run: npm test
lint:
Expand Down
7 changes: 4 additions & 3 deletions test/login.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ const request = require('request')
const host = global.host || 'http://localhost:3000'

console.log('注意: 测试登录需在 test/login.test.js 中填写账号密码!!!');

const phone = ''
const password = ''
describe('测试登录是否正常', () => {
it('手机登录 code 应该等于200', done => {
const qs = {
phone: phone,
password: password
phone: process.env.NCM_API_TEST_LOGIN_PHONE || phone || '',
password: process.env.NCM_API_TEST_LOGIN_PASSWORD || password || ''
}

request.get({url: `${host}/login/cellphone`, qs: qs}, (err, res, body) => {
Expand Down

0 comments on commit bc71f53

Please sign in to comment.