Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: check errors for build tools #19

Closed
wants to merge 14 commits into from
2 changes: 1 addition & 1 deletion scripts/build-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (require.main === module) {
const manualToolsPath = resolve(__dirname, '../config', 'tools-manual.json');
const toolsPath = resolve(__dirname, '../config', 'tools.json');
const tagsPath = resolve(__dirname, '../config', 'all-tags.json');

buildTools(automatedToolsPath, manualToolsPath, toolsPath, tagsPath);
}

Expand Down
5 changes: 5 additions & 0 deletions scripts/hello.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function hello (){
return "hello"
}

module.exports = hello
3 changes: 2 additions & 1 deletion tests/build-newsroom-videos.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { readFileSync, removeSync, mkdirpSync } = require('fs-extra');
const { readFileSync, removeSync, mkdirpSync, outputFileSync } = require('fs-extra');
const { resolve, join } = require('path');
const { buildNewsroomVideos } = require('../scripts/build-newsroom-videos');
const { mockApiResponse, expectedResult } = require('./fixtures/newsroomData');
Expand All @@ -13,6 +13,7 @@ describe('buildNewsroomVideos', () => {

beforeAll(() => {
mkdirpSync(testDir);
outputFileSync(testFilePath, JSON.stringify({}));
process.env.YOUTUBE_TOKEN = 'testkey';
});

Expand Down
4 changes: 4 additions & 0 deletions tests/build-tools.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ describe('buildTools', () => {
consoleErrorMock = jest.spyOn(console, 'error').mockImplementation(() => {});
fs.ensureDirSync(testDir);
fs.outputFileSync(manualToolsPath, JSON.stringify(manualTools));
fs.outputFileSync(automatedToolsPath, JSON.stringify({}));
fs.outputFileSync(toolsPath, JSON.stringify({}));
fs.outputFileSync(tagsPath, JSON.stringify({}));

});

afterAll(() => {
Expand Down
10 changes: 10 additions & 0 deletions tests/hello.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const hello = require('../scripts/hello')

describe('hello function', () => {

it('should say hello', async () => {
let x = hello()
expect(x).toBe("hello")
});

});
Loading