Skip to content

Commit

Permalink
v3 (#19)
Browse files Browse the repository at this point in the history
* v3 init

Signed-off-by: Stiliyan Ivanov <[email protected]>

* Improve tests

Signed-off-by: Stiliyan Ivanov <[email protected]>

---------

Signed-off-by: Stiliyan Ivanov <[email protected]>
  • Loading branch information
madwings authored Oct 24, 2023
1 parent 98c3bf3 commit b8301e3
Show file tree
Hide file tree
Showing 5 changed files with 5,720 additions and 4,188 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const request = require('./axios_utils');

const baseUrl = 'https://api.sharedcount.com/v1.0/';
const baseUrl = 'https://api.sharedcount.com/v1.1/';

const addHttpToUrl = url => (url.includes('http') ? url : `http://${url}`);

Expand Down
14 changes: 7 additions & 7 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const Sharedcount = require('./index');

nock.disableNetConnect();

const baseUrl = 'https://api.sharedcount.com';
const baseUrl = 'https://api.sharedcount.com/v1.1';
const apiKey = 'TEST_API_KEY';
const expectedResult = { result: 'ok' };

Expand All @@ -17,7 +17,7 @@ describe('Sharedcount unit tests', () => {
it('url', async () => {
const url = 'http://domain.com';
nock(baseUrl)
.get('/v1.0/')
.get('/')
.query({ apiKey, url })
.reply(200, expectedResult);
const result = await sc.url(url);
Expand All @@ -27,7 +27,7 @@ describe('Sharedcount unit tests', () => {
it('url (without http prefix)', async () => {
const domain = 'domain.com';
nock(baseUrl)
.get('/v1.0/')
.get('/')
.query({ apiKey, url: `http://${domain}` })
.reply(200, expectedResult);
const result = await sc.url(domain);
Expand All @@ -36,7 +36,7 @@ describe('Sharedcount unit tests', () => {

it('domain whitelist', async () => {
nock(baseUrl)
.get('/v1.0/domain_whitelist')
.get('/domain_whitelist')
.query({ apiKey })
.reply(200, expectedResult);

Expand All @@ -46,7 +46,7 @@ describe('Sharedcount unit tests', () => {

it('usage', async () => {
nock(baseUrl)
.get('/v1.0/usage')
.get('/usage')
.query({ apiKey })
.reply(200, expectedResult);

Expand All @@ -56,7 +56,7 @@ describe('Sharedcount unit tests', () => {

it('quota', async () => {
nock(baseUrl)
.get('/v1.0/quota')
.get('/quota')
.query({ apiKey })
.reply(200, expectedResult);

Expand All @@ -66,7 +66,7 @@ describe('Sharedcount unit tests', () => {

it('status', async () => {
nock(baseUrl)
.get('/v1.0/status')
.get('/status')
.query({ apiKey })
.reply(200, expectedResult);

Expand Down
Loading

0 comments on commit b8301e3

Please sign in to comment.