Skip to content

Commit

Permalink
Lint project and ensure test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhoomtawath Plinsut committed Mar 7, 2019
1 parent bce1acb commit e5c4034
Show file tree
Hide file tree
Showing 70 changed files with 1,766 additions and 1,774 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"rules": {
"no-var": "off",
"max-len": [
"error",
"warn",
80
],
"linebreak-style": [
Expand Down
4 changes: 2 additions & 2 deletions test/config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

var config = {
publicKey: process.env.OMISE_PUBLIC_KEY,
secretKey: process.env.OMISE_SECRET_KEY,
publicKey: process.env.OMISE_PUBLIC_KEY,
secretKey: process.env.OMISE_SECRET_KEY,
omiseVersion: '2015-09-10',
};

Expand Down
8 changes: 4 additions & 4 deletions test/mocks/account_retrieve.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ nock('https://api.omise.co')
.persist()
.get('/account')
.reply(200, {
'object': 'account',
'id': 'acct_123',
'email': 'test@omise.co',
'object': 'account',
'id': 'acct_123',
'email': 'test@omise.co',
'created': '2015-02-02T13:19:17Z',
}, {
'server': 'nginx/1.1',
'server': 'nginx/1.1',
'content-type': 'application/json',
});
10 changes: 5 additions & 5 deletions test/mocks/balance_retrieve.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ nock('https://api.omise.co')
.persist()
.get('/balance')
.reply(200, {
'object': 'balance',
'livemode': false,
'object': 'balance',
'livemode': false,
'available': 97242,
'total': 385524,
'currency': 'thb',
'total': 385524,
'currency': 'thb',
}, {
'server': 'nginx/1.1',
'server': 'nginx/1.1',
'content-type': 'application/json',
});
8 changes: 4 additions & 4 deletions test/mocks/card_destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ nock('https://api.omise.co')
.persist()
.intercept('/customers/' + custID + '/cards/' + cardID, 'DELETE')
.reply(200, {
'object': 'card',
'id': cardID,
'object': 'card',
'id': cardID,
'livemode': false,
'deleted': true,
'deleted': true,
}, {
'server': 'nginx/1.1',
'server': 'nginx/1.1',
'content-type': 'application/json',
});
32 changes: 16 additions & 16 deletions test/mocks/card_retrieve.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ nock('https://api.omise.co')
.persist()
.get(url)
.reply(200, {
'object': 'card',
'id': cardID,
'livemode': false,
'location': url,
'country': 'us',
'city': 'Bangkok',
'postal_code': '10320',
'financing': '',
'last_digits': '4242',
'brand': 'Visa',
'expiration_month': 2,
'expiration_year': 2017,
'fingerprint': 'umrBpbHRuc8vstbcNEZPbnKkIycR/gvI6ivW9AshKCw=',
'name': 'JOHN DOE',
'object': 'card',
'id': cardID,
'livemode': false,
'location': url,
'country': 'us',
'city': 'Bangkok',
'postal_code': '10320',
'financing': '',
'last_digits': '4242',
'brand': 'Visa',
'expiration_month': 2,
'expiration_year': 2017,
'fingerprint': 'umrBpbHRuc8vstbcNEZPbnKkIycR/gvI6ivW9AshKCw=',
'name': 'JOHN DOE',
'security_code_check': true,
'created': '2015-02-16T03:12:10Z',
'created': '2015-02-16T03:12:10Z',
}, {
'server': 'nginx/1.1',
'server': 'nginx/1.1',
'content-type': 'application/json',
});
32 changes: 16 additions & 16 deletions test/mocks/card_update.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ nock('https://api.omise.co')
.persist()
.intercept(url, 'PATCH')
.reply(200, {
'object': 'card',
'id': cardID,
'livemode': false,
'location': url,
'country': 'us',
'city': 'Bangkok',
'postal_code': '10320',
'financing': '',
'last_digits': '4242',
'brand': 'Visa',
'expiration_month': 9,
'expiration_year': 2022,
'fingerprint': 'umrBpbHRuc8vstbcNEZPbnKkIycR/gvI6ivW9AshKCw=',
'name': 'JOHN DOE',
'object': 'card',
'id': cardID,
'livemode': false,
'location': url,
'country': 'us',
'city': 'Bangkok',
'postal_code': '10320',
'financing': '',
'last_digits': '4242',
'brand': 'Visa',
'expiration_month': 9,
'expiration_year': 2022,
'fingerprint': 'umrBpbHRuc8vstbcNEZPbnKkIycR/gvI6ivW9AshKCw=',
'name': 'JOHN DOE',
'security_code_check': true,
'created': '2015-02-16T03:12:10Z',
'created': '2015-02-16T03:12:10Z',
}, {
'server': 'nginx/1.1',
'server': 'nginx/1.1',
'content-type': 'application/json',
});
42 changes: 21 additions & 21 deletions test/mocks/cards_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,30 @@ nock('https://api.omise.co')
.get(cardURL)
.reply(200, {
'object': 'list',
'from': '1970-01-01T00:00:00+00:00',
'to': '2015-02-23T08:44:27+00:00',
'from': '1970-01-01T00:00:00+00:00',
'to': '2015-02-23T08:44:27+00:00',
'offset': 0,
'limit': 20,
'total': 1,
'data': [{
'object': 'card',
'id': cardID,
'livemode': false,
'location': cardURL + '/' + cardID,
'country': 'us',
'city': 'Bangkok',
'postal_code': '10320',
'financing': '',
'last_digits': '4242',
'brand': 'Visa',
'expiration_month': 2,
'expiration_year': 2017,
'fingerprint': 'umrBpbHRuc8vstbcNEZPbnKkIycR/gvI6ivW9AshKCw=',
'name': 'JOHN DOE',
'limit': 20,
'total': 1,
'data': [{
'object': 'card',
'id': cardID,
'livemode': false,
'location': cardURL + '/' + cardID,
'country': 'us',
'city': 'Bangkok',
'postal_code': '10320',
'financing': '',
'last_digits': '4242',
'brand': 'Visa',
'expiration_month': 2,
'expiration_year': 2017,
'fingerprint': 'umrBpbHRuc8vstbcNEZPbnKkIycR/gvI6ivW9AshKCw=',
'name': 'JOHN DOE',
'security_code_check': true,
'created': '2015-02-16T03:12:10Z',
'created': '2015-02-16T03:12:10Z',
}],
}, {
'server': 'nginx/1.1',
'server': 'nginx/1.1',
'content-type': 'application/json',
});
136 changes: 68 additions & 68 deletions test/mocks/charge_schedules_create.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,72 +5,72 @@ var chargeScheduleID = 'schd_test_5aikygh29nc6u68xuib';
var cardID = 'card_test_5a4j05gs3evyhnywwg8';

nock('https://api.omise.co')
.persist()
.post('/schedules')
.reply(200, {
"object": "schedule",
"id": chargeScheduleID,
"livemode": false,
"location": "/schedules/" + chargeScheduleID,
"status": "active",
"every": 1,
"period": "month",
"on": {
"days_of_month": [
1
]
.persist()
.post('/schedules')
.reply(200, {
'object': 'schedule',
'id': chargeScheduleID,
'livemode': false,
'location': '/schedules/' + chargeScheduleID,
'status': 'active',
'every': 1,
'period': 'month',
'on': {
'days_of_month': [
1,
],
},
'in_words': 'Every 1 month(s) on the 1st',
'start_date': '2018-01-04',
'end_date': '2019-01-04',
'charge': {
'amount': 200000,
'currency': 'thb',
'description': 'schedule charge id:1',
'customer': customerID,
'card': cardID,
},
'occurrences': {
'object': 'list',
'from': '1970-01-01T00:00:00Z',
'to': '2018-03-02T07:38:41Z',
'offset': 0,
'limit': 20,
'total': 3,
'order': null,
'location': '/schedules/' + chargeScheduleID + '/occurrences',
'data': [
{
'object': 'occurrence',
'id': 'occu_test_5aikygh5c4qhpulod8v',
'livemode': false,
'location': '/occurrences/occu_test_5aikygh5c4qhpulod8v',
'schedule': chargeScheduleID,
'schedule_date': '2018-02-01',
'retry_date': null,
'processed_at': '2018-02-01T01:31:53Z',
'status': 'successful',
'message': null,
'result': 'chrg_test_5ath86asi8q61o7ip6u',
'created': '2018-01-04T04:55:30Z',
},
"in_words": "Every 1 month(s) on the 1st",
"start_date": "2018-01-04",
"end_date": "2019-01-04",
"charge": {
"amount": 200000,
"currency": "thb",
"description": "schedule charge id:1",
"customer": customerID,
"card": cardID
},
"occurrences": {
"object": "list",
"from": "1970-01-01T00:00:00Z",
"to": "2018-03-02T07:38:41Z",
"offset": 0,
"limit": 20,
"total": 3,
"order": null,
"location": "/schedules/" + chargeScheduleID + "/occurrences",
"data": [
{
"object": "occurrence",
"id": "occu_test_5aikygh5c4qhpulod8v",
"livemode": false,
"location": "/occurrences/occu_test_5aikygh5c4qhpulod8v",
"schedule": chargeScheduleID,
"schedule_date": "2018-02-01",
"retry_date": null,
"processed_at": "2018-02-01T01:31:53Z",
"status": "successful",
"message": null,
"result": "chrg_test_5ath86asi8q61o7ip6u",
"created": "2018-01-04T04:55:30Z"
}
]
},
"next_occurrence_dates": [
"2018-03-01",
"2018-04-01",
"2018-05-01",
"2018-06-01",
"2018-07-01",
"2018-08-01",
"2018-09-01",
"2018-10-01",
"2018-11-01",
"2018-12-01",
"2019-01-01"
],
"created": "2018-01-04T04:55:30Z"
}, {
'server': 'nginx/1.1',
'content-type': 'application/json',
});
],
},
'next_occurrence_dates': [
'2018-03-01',
'2018-04-01',
'2018-05-01',
'2018-06-01',
'2018-07-01',
'2018-08-01',
'2018-09-01',
'2018-10-01',
'2018-11-01',
'2018-12-01',
'2019-01-01',
],
'created': '2018-01-04T04:55:30Z',
}, {
'server': 'nginx/1.1',
'content-type': 'application/json',
});
Loading

0 comments on commit e5c4034

Please sign in to comment.