From c88ce6d0f17eb7d86571735c8d2f72726e662d8b Mon Sep 17 00:00:00 2001 From: Alexander Milevski Date: Tue, 7 Sep 2021 19:14:07 +0200 Subject: [PATCH 1/3] Added milestones test --- test/index.test.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/test/index.test.js b/test/index.test.js index 69c2582..da86ce3 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -4,7 +4,7 @@ const { assert } = require('chai'); const path = require('path'); const { version } = require('../package.json'); -const API_KEY = 'API_KEY'; +const API_KEY = process.env.GITHUB_API_TOKEN; const owner = 'Linkurious'; const repository = 'github-client'; @@ -40,8 +40,17 @@ describe('Github client', () => { }); -describe.skip('API calls', () => { - it('should be able to create a file', () => { +describe('API calls', () => { + + it.only('should be able to get the milestones', () => { + const client = getClient(); + return client.getMilestones().then(milestones => { + console.log(milestones); + }); + }); + + + it.skip('should be able to create a file', () => { const client = getClient(); const fileName = 'file.txt'; return client.createFile({ @@ -55,7 +64,7 @@ describe.skip('API calls', () => { }); }); - it('should be able to update a file', () => { + it.skip('should be able to update a file', () => { const client = getClient(); const fileName = 'file.txt'; const message = `[test] Updated ${fileName}`; @@ -69,7 +78,7 @@ describe.skip('API calls', () => { }); }); - it('should be able to remove a file', () => { + it.skip('should be able to remove a file', () => { const client = getClient(); const fileName = 'file.txt'; const message = `[test] Deleted ${fileName}`; @@ -88,7 +97,7 @@ describe.skip('API calls', () => { .then(release => assert.equal(release.id, 32628987)); }); - it('should be able to upload a release', () => { + it.skip('should be able to upload a release', () => { const client = getClient(); const name = `GH agent v${version}`; const body = '### Markdown'; From ee5c09a095ebff4d34d6dedf1c865c0b9e8017c7 Mon Sep 17 00:00:00 2001 From: Alexander Milevski Date: Tue, 7 Sep 2021 19:27:23 +0200 Subject: [PATCH 2/3] Trying to test --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 47b74f5..670ed8b 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "main": "index.js", "scripts": { "test": "mocha test/**/*.test.js --timeout 3000", + "changelog": "npm run test", "test:unit": "nyc --reporter=text-summary --reporter=cobertura --report-dir=reports mocha --timeout 3000 --reporter mocha-multi-reporters --reporter-options configFile=.test-reporters.json test/**/**.test.js", "lint": "eslint --fix --ext .js .", "postversion": "sync_versions" From 4c72f7d8a8a5ed217c04d6ca09543c65ba5957a6 Mon Sep 17 00:00:00 2001 From: Alexander Milevski Date: Tue, 7 Sep 2021 19:30:21 +0200 Subject: [PATCH 3/3] Trying to test --- test/index.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/index.test.js b/test/index.test.js index da86ce3..f09028f 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -10,8 +10,8 @@ const owner = 'Linkurious'; const repository = 'github-client'; const apiKey = 'apiKey'; -const getClient = () => new Client({ - repository: 'github-agent', +const getClient = ({ repository } = {}) => new Client({ + repository: repository || 'github-agent', owner: 'Linkurious', apiKey: API_KEY }); @@ -43,7 +43,7 @@ describe('Github client', () => { describe('API calls', () => { it.only('should be able to get the milestones', () => { - const client = getClient(); + const client = getClient({ repository: 'ogma' }); return client.getMilestones().then(milestones => { console.log(milestones); });