Skip to content

Commit 7e543b0

Browse files
Refactor tests (#30)
* Renamed node.js.yml to build.yml * Moved test files 1. Moved `tests/1/` and `tests/2/` to `src/1/__tests__/` and `src/2/__tests__/` respectively 2. Updated relative imports 3. Updated test file paths * Moved test files for challenge 3, updated README for challenge 3 * Updated readme for challenge 1 and challenge 2 * Moved tests for challenge 4. Updated readme for challenge 4 * Updated readme and tests for challenge 5 * Updated tests and readme for challenge 6 * Updated tests and readme for challenge 7 * Updated tests and readme for challenge 8 * Updated test files and readme for challenge 9 * Updated tests and readme for challenge 10 * Updated readme and tests for challenge 11 * Updated tests and readme for challenge 13 * Updated readme and tests for challenge 14 * Updated tests and readme for challenge 15 * Updated tests and readme for challenge 16 * Updated readme and tests for challenge 17. Updated jest config file * Updated comments for challenge 1 tests. Updated global readme. * Updated tests for grep. Using LINUX path systems everywhere. * Updated path to shell.js, added console statements in cat.test.ts * Fixed challenge 14 and 15, updated readme for challenge 19 The challenges were referring to the `.js` file present in `./build/src` folders. Since the `tests` folder was removed, now there is no `src` folder present and we can directly using `./build` folder to refer to the `.js` files
1 parent 1c32c20 commit 7e543b0

File tree

117 files changed

+161
-141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+161
-141
lines changed
File renamed without changes.

README.md

Lines changed: 3 additions & 3 deletions

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
roots: ['<rootDir>/src', '<rootDir>/tests'],
2+
roots: ['<rootDir>/src'],
33
testMatch: [
44
'**/__tests__/**/*.+(ts|tsx|js)',
55
'**/?(*.)+(spec|test).+(ts|tsx|js)'

src/1/README.md

Lines changed: 2 additions & 2 deletions
File renamed without changes.
File renamed without changes.

tests/1/wc.test.ts renamed to src/1/__tests__/wc.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import { execSync } from 'child_process';
22
import fs from 'fs';
3-
import { myWC } from '../../src/1/wc';
3+
import { myWC } from '../wc';
4+
import path from 'path';
45

5-
const filePaths = ['./tests/1/test1.txt', './tests/1/test2.txt'];
6+
const filePaths = [
7+
path.join(__dirname, 'test1.txt'),
8+
path.join(__dirname, 'test2.txt')
9+
];
610

711
describe('Testing with filenames', () => {
812
filePaths.forEach((filePath) => {
@@ -11,7 +15,7 @@ describe('Testing with filenames', () => {
1115
.trim()
1216
.replace(/ +(?= )/g, '')
1317
.split(' ');
14-
// Sample output - 0 0 0 ./tests/1/test1.txt
18+
// Sample output - 0 0 0 ./src/1/__tests__/test1.txt
1519

1620
const l = output[0];
1721
const w = output[1];
@@ -57,7 +61,7 @@ describe('Testing without filename', () => {
5761
.trim()
5862
.replace(/ +(?= )/g, '')
5963
.split(' ');
60-
// Sample output - 0 0 0 ./tests/1/test1.txt
64+
// Sample output - 0 0 0 ./src/1/__tests__/test1.txt
6165

6266
const l = output[0];
6367
const w = output[1];

src/10/README.md

Lines changed: 2 additions & 2 deletions
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)