From 276e52365d9047fd07dfe42c3272a3b4971aeb52 Mon Sep 17 00:00:00 2001 From: Vishvamsinh Vaghela Date: Fri, 22 Nov 2024 12:07:46 +0530 Subject: [PATCH 01/13] hello test --- scripts/hello.js | 5 +++++ tests/hello.test.js | 9 +++++++++ 2 files changed, 14 insertions(+) create mode 100644 scripts/hello.js create mode 100644 tests/hello.test.js diff --git a/scripts/hello.js b/scripts/hello.js new file mode 100644 index 000000000000..37349de8a3d9 --- /dev/null +++ b/scripts/hello.js @@ -0,0 +1,5 @@ +function hello (){ + return "hello" +} + +module.exports = hello \ No newline at end of file diff --git a/tests/hello.test.js b/tests/hello.test.js new file mode 100644 index 000000000000..5debc3f9e05d --- /dev/null +++ b/tests/hello.test.js @@ -0,0 +1,9 @@ +const hello = require('../scripts/hello') + +describe('hello function', () => { + + it('should say hello', async () => { + let x = hello() + expect(x).toBe("hello") + }); +}); From af1d5e59c30bf1cd23547454e0498e36a9c5c464 Mon Sep 17 00:00:00 2001 From: Vishvamsinh Vaghela Date: Fri, 22 Nov 2024 12:20:30 +0530 Subject: [PATCH 02/13] file created --- tests/build-tools.test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/build-tools.test.js b/tests/build-tools.test.js index 74524ddb9775..2aa33b0fd21f 100644 --- a/tests/build-tools.test.js +++ b/tests/build-tools.test.js @@ -37,6 +37,7 @@ describe('buildTools', () => { consoleErrorMock = jest.spyOn(console, 'error').mockImplementation(() => {}); fs.ensureDirSync(testDir); fs.outputFileSync(manualToolsPath, JSON.stringify(manualTools)); + fs.outputFileSync(automatedToolsPath, JSON.stringify({})); }); afterAll(() => { From c308f44e5724f9694542d0e44702b7412faf2e81 Mon Sep 17 00:00:00 2001 From: Vishvamsinh Vaghela Date: Fri, 22 Nov 2024 12:24:29 +0530 Subject: [PATCH 03/13] test updated --- .github/workflows/if-nodejs-pr-testing.yml | 76 +++++++++++----------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/.github/workflows/if-nodejs-pr-testing.yml b/.github/workflows/if-nodejs-pr-testing.yml index d5489e7ab8f2..95101a27b1b0 100644 --- a/.github/workflows/if-nodejs-pr-testing.yml +++ b/.github/workflows/if-nodejs-pr-testing.yml @@ -80,46 +80,46 @@ jobs: shell: bash run: npm run generate:assets --if-present - # Run the test:md script and capture output - - if: ${{ steps.packagejson.outputs.exists == 'true' && matrix.os == 'ubuntu-latest' }} - name: Run markdown checks - id: markdown_check - run: | - ERRORS=$(npm run test:md | sed -n '/Errors in file/,$p') - echo "markdown_output<> $GITHUB_OUTPUT - echo "$ERRORS" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT + # # Run the test:md script and capture output + # - if: ${{ steps.packagejson.outputs.exists == 'true' && matrix.os == 'ubuntu-latest' }} + # name: Run markdown checks + # id: markdown_check + # run: | + # ERRORS=$(npm run test:md | sed -n '/Errors in file/,$p') + # echo "markdown_output<> $GITHUB_OUTPUT + # echo "$ERRORS" >> $GITHUB_OUTPUT + # echo "EOF" >> $GITHUB_OUTPUT - # Post a comment using sticky-pull-request-comment - - name: Comment on PR with markdown issues - if: ${{ steps.markdown_check.outputs.markdown_output != '' && matrix.os == 'ubuntu-latest' }} - uses: marocchino/sticky-pull-request-comment@3d60a5b2dae89d44e0c6ddc69dd7536aec2071cd - with: - header: markdown-check-error - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - message: | - ### Markdown Check Results + # # Post a comment using sticky-pull-request-comment + # - name: Comment on PR with markdown issues + # if: ${{ steps.markdown_check.outputs.markdown_output != '' && matrix.os == 'ubuntu-latest' }} + # uses: marocchino/sticky-pull-request-comment@3d60a5b2dae89d44e0c6ddc69dd7536aec2071cd + # with: + # header: markdown-check-error + # GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + # message: | + # ### Markdown Check Results - We found issues in the following markdown files: + # We found issues in the following markdown files: - ``` - ${{ steps.markdown_check.outputs.markdown_output }} - ``` + # ``` + # ${{ steps.markdown_check.outputs.markdown_output }} + # ``` - # Delete the comment if there are no issues - - if: ${{ steps.markdown_check.outputs.markdown_output == '' && matrix.os == 'ubuntu-latest' }} - name: Delete markdown check comment - uses: marocchino/sticky-pull-request-comment@3d60a5b2dae89d44e0c6ddc69dd7536aec2071cd - with: - header: markdown-check-error - delete: true - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + # # Delete the comment if there are no issues + # - if: ${{ steps.markdown_check.outputs.markdown_output == '' && matrix.os == 'ubuntu-latest' }} + # name: Delete markdown check comment + # uses: marocchino/sticky-pull-request-comment@3d60a5b2dae89d44e0c6ddc69dd7536aec2071cd + # with: + # header: markdown-check-error + # delete: true + # GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - - if: steps.packagejson.outputs.exists == 'true' - name: Upload Coverage to Codecov - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 - with: - fail_ci_if_error: true - files: ./coverage/lcov.info - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true + # - if: steps.packagejson.outputs.exists == 'true' + # name: Upload Coverage to Codecov + # uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 + # with: + # fail_ci_if_error: true + # files: ./coverage/lcov.info + # token: ${{ secrets.CODECOV_TOKEN }} + # verbose: true From 4dc6ffe80f6da44cad24ae709897d732dc907a2f Mon Sep 17 00:00:00 2001 From: Vishvamsinh Vaghela Date: Fri, 22 Nov 2024 12:27:00 +0530 Subject: [PATCH 04/13] test updated --- .github/workflows/if-nodejs-pr-testing.yml | 46 +--------------------- 1 file changed, 1 insertion(+), 45 deletions(-) diff --git a/.github/workflows/if-nodejs-pr-testing.yml b/.github/workflows/if-nodejs-pr-testing.yml index 95101a27b1b0..9c755e579d5d 100644 --- a/.github/workflows/if-nodejs-pr-testing.yml +++ b/.github/workflows/if-nodejs-pr-testing.yml @@ -78,48 +78,4 @@ jobs: - if: steps.packagejson.outputs.exists == 'true' name: Run release assets generation to make sure PR does not break it shell: bash - run: npm run generate:assets --if-present - - # # Run the test:md script and capture output - # - if: ${{ steps.packagejson.outputs.exists == 'true' && matrix.os == 'ubuntu-latest' }} - # name: Run markdown checks - # id: markdown_check - # run: | - # ERRORS=$(npm run test:md | sed -n '/Errors in file/,$p') - # echo "markdown_output<> $GITHUB_OUTPUT - # echo "$ERRORS" >> $GITHUB_OUTPUT - # echo "EOF" >> $GITHUB_OUTPUT - - # # Post a comment using sticky-pull-request-comment - # - name: Comment on PR with markdown issues - # if: ${{ steps.markdown_check.outputs.markdown_output != '' && matrix.os == 'ubuntu-latest' }} - # uses: marocchino/sticky-pull-request-comment@3d60a5b2dae89d44e0c6ddc69dd7536aec2071cd - # with: - # header: markdown-check-error - # GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - # message: | - # ### Markdown Check Results - - # We found issues in the following markdown files: - - # ``` - # ${{ steps.markdown_check.outputs.markdown_output }} - # ``` - - # # Delete the comment if there are no issues - # - if: ${{ steps.markdown_check.outputs.markdown_output == '' && matrix.os == 'ubuntu-latest' }} - # name: Delete markdown check comment - # uses: marocchino/sticky-pull-request-comment@3d60a5b2dae89d44e0c6ddc69dd7536aec2071cd - # with: - # header: markdown-check-error - # delete: true - # GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - - # - if: steps.packagejson.outputs.exists == 'true' - # name: Upload Coverage to Codecov - # uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 - # with: - # fail_ci_if_error: true - # files: ./coverage/lcov.info - # token: ${{ secrets.CODECOV_TOKEN }} - # verbose: true + run: npm run generate:assets --if-present \ No newline at end of file From e290291ca4da1616b5ce48965d02a42c83744436 Mon Sep 17 00:00:00 2001 From: Vishvamsinh Vaghela Date: Fri, 22 Nov 2024 12:29:56 +0530 Subject: [PATCH 05/13] test update --- tests/hello.test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/hello.test.js b/tests/hello.test.js index 5debc3f9e05d..c27d5085a82c 100644 --- a/tests/hello.test.js +++ b/tests/hello.test.js @@ -6,4 +6,5 @@ describe('hello function', () => { let x = hello() expect(x).toBe("hello") }); + }); From eb14063be571fb53cba9b4abd653406a182a25af Mon Sep 17 00:00:00 2001 From: Vishvamsinh Vaghela Date: Fri, 22 Nov 2024 12:38:13 +0530 Subject: [PATCH 06/13] test udpated --- scripts/build-tools.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/build-tools.js b/scripts/build-tools.js index c5cce74a7cb1..67c9df7c20d8 100644 --- a/scripts/build-tools.js +++ b/scripts/build-tools.js @@ -23,7 +23,6 @@ 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); } From fd0cea164423f64ecebbe8f032429a0712c9143d Mon Sep 17 00:00:00 2001 From: Vishvamsinh Vaghela Date: Fri, 22 Nov 2024 12:41:00 +0530 Subject: [PATCH 07/13] test udpated --- scripts/build-tools.js | 1 + tests/build-tools.test.js | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/build-tools.js b/scripts/build-tools.js index 67c9df7c20d8..5a60604d7479 100644 --- a/scripts/build-tools.js +++ b/scripts/build-tools.js @@ -23,6 +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); } diff --git a/tests/build-tools.test.js b/tests/build-tools.test.js index 2aa33b0fd21f..470ffa077cc6 100644 --- a/tests/build-tools.test.js +++ b/tests/build-tools.test.js @@ -91,4 +91,5 @@ describe('buildTools', () => { expect(err.message).toMatch(/ENOENT|EACCES/); } }); + }); From c1a2dd54cecc1fc630fd229a7616c00585d61556 Mon Sep 17 00:00:00 2001 From: Vishvamsinh Vaghela Date: Fri, 22 Nov 2024 12:41:17 +0530 Subject: [PATCH 08/13] kg kug --- tests/build-tools.test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/build-tools.test.js b/tests/build-tools.test.js index 470ffa077cc6..a3ab20e0216f 100644 --- a/tests/build-tools.test.js +++ b/tests/build-tools.test.js @@ -90,6 +90,7 @@ describe('buildTools', () => { } catch (err) { expect(err.message).toMatch(/ENOENT|EACCES/); } + }); - + }); From 71cc1f97be591878448bec4042ef69aafd10e2ea Mon Sep 17 00:00:00 2001 From: Vishvamsinh Vaghela Date: Fri, 22 Nov 2024 12:46:48 +0530 Subject: [PATCH 09/13] tetsewge --- scripts/build-tools.js | 1 - tests/build-newsroom-videos.test.js | 3 ++- tests/build-tools.test.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/build-tools.js b/scripts/build-tools.js index 5a60604d7479..67c9df7c20d8 100644 --- a/scripts/build-tools.js +++ b/scripts/build-tools.js @@ -23,7 +23,6 @@ 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); } diff --git a/tests/build-newsroom-videos.test.js b/tests/build-newsroom-videos.test.js index 494f91f27341..188bc2dffc70 100644 --- a/tests/build-newsroom-videos.test.js +++ b/tests/build-newsroom-videos.test.js @@ -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'); @@ -13,6 +13,7 @@ describe('buildNewsroomVideos', () => { beforeAll(() => { mkdirpSync(testDir); + outputFileSync(testFilePath, JSON.stringify({})); process.env.YOUTUBE_TOKEN = 'testkey'; }); diff --git a/tests/build-tools.test.js b/tests/build-tools.test.js index a3ab20e0216f..e9b6b333e881 100644 --- a/tests/build-tools.test.js +++ b/tests/build-tools.test.js @@ -90,7 +90,7 @@ describe('buildTools', () => { } catch (err) { expect(err.message).toMatch(/ENOENT|EACCES/); } - + }); }); From 31b292a25afd33786c311ad636c94e26754dae66 Mon Sep 17 00:00:00 2001 From: Vishvamsinh Vaghela Date: Fri, 22 Nov 2024 13:00:17 +0530 Subject: [PATCH 10/13] new data --- tests/build-tools.test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/build-tools.test.js b/tests/build-tools.test.js index e9b6b333e881..12700b2beea5 100644 --- a/tests/build-tools.test.js +++ b/tests/build-tools.test.js @@ -38,6 +38,9 @@ describe('buildTools', () => { 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(() => { From 824f747bc21ac9628fd6cb3dabfdbc7c8136f606 Mon Sep 17 00:00:00 2001 From: Vishvamsinh Vaghela Date: Fri, 22 Nov 2024 13:02:53 +0530 Subject: [PATCH 11/13] new datagu --- tests/build-tools.test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/build-tools.test.js b/tests/build-tools.test.js index 12700b2beea5..2143e5c84cc6 100644 --- a/tests/build-tools.test.js +++ b/tests/build-tools.test.js @@ -93,7 +93,6 @@ describe('buildTools', () => { } catch (err) { expect(err.message).toMatch(/ENOENT|EACCES/); } - }); }); From a017b934dcd0a8c03c5351cba1e63847a333b108 Mon Sep 17 00:00:00 2001 From: Vishvamsinh Vaghela Date: Fri, 22 Nov 2024 13:05:45 +0530 Subject: [PATCH 12/13] giu uyfut --- tests/build-tools.test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/build-tools.test.js b/tests/build-tools.test.js index 2143e5c84cc6..a76f6eb0bc9b 100644 --- a/tests/build-tools.test.js +++ b/tests/build-tools.test.js @@ -94,5 +94,4 @@ describe('buildTools', () => { expect(err.message).toMatch(/ENOENT|EACCES/); } }); - }); From 06aebbcf9ab5164d8d7cf9b83f855ff3aed747e6 Mon Sep 17 00:00:00 2001 From: Vishvamsinh Vaghela Date: Fri, 22 Nov 2024 13:11:37 +0530 Subject: [PATCH 13/13] giu uyfut i --- scripts/build-tools.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/build-tools.js b/scripts/build-tools.js index 67c9df7c20d8..5a60604d7479 100644 --- a/scripts/build-tools.js +++ b/scripts/build-tools.js @@ -23,6 +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); }