-
Notifications
You must be signed in to change notification settings - Fork 408
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
Added base test #254
Added base test #254
Conversation
alexandra-protyanova
commented
Jan 18, 2024
•
edited
Loading
edited
const baseCommand = 'node src/app.js'; | ||
let sourceContent = ''; | ||
const tempDir = path.join('tests', faker.word.noun()); | ||
|
||
const sourceFile = path.join(tempDir, faker.system.commonFileName('txt')); | ||
const destinationFile = path.join( | ||
tempDir, | ||
faker.system.commonFileName('txt'), | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason to have some constants inside the describe
but the other's outside?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I based on the imports system which should be out of describe, but I read that it is commonly good practise to store requires out of describe
fs.rmdirSync(tempDir, { recursive: true }); | ||
}); | ||
|
||
test('should throw an error if only one argument is provided', async() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Students will start from success story
So it is more logical to test success flow first
tests/copyFiles.test.js
Outdated
test('should copy file to a new destination overwriting existing content', async() => { | ||
const differentContent = faker.lorem.paragraph(); | ||
|
||
fs.writeFileSync(destinationFile, differentContent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use the same file all the time
What if prew tests block it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed