-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
New Test Suite: ToDo Module #270
base: develop
Are you sure you want to change the base?
Conversation
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.
Thanks for your contribution! @JoeVanKessel
Could you explain a little bit more why this change would be useful, compared to the current tests we currently have ?
@@ -0,0 +1,221 @@ | |||
function getPossibleExpressions(expressionType, count) { | |||
const data = require('../data/expressions/en.json') |
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.
You should not use the CJS require
syntax, instead use the ESM import.
return data.todolist.view_lists.expressions | ||
case "view list": | ||
return data.todolist.view_list.expressions | ||
case "rename list": |
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.
Instead to return the same things for multiple values of expressionType
, you can do something like that :
case "view lists":
case "view list":
return data.todolist.view_list.expressions
const fs = require('fs') | ||
const path = require('path') |
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.
Instead to use the CJS require
syntax, use the ESM import at the top of the file.
function getOutputs(){ | ||
const fs = require('fs') | ||
const path = require('path') | ||
let data = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../data/db/calendar.spec.json'))) |
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.
You should not use let
if you don't redeclare the variable, instead use const
.
Also instead to use fs.readFileSync
, use the promises based API instead, like fs.promises.readFile
and you can create a new variable to store path.resolve(__dirname, '../data/db/calendar.spec.json'))
, it will probably be clearer. 👍
|
||
async function testCreateListExpressions(count) { | ||
const expression = getPossibleExpressions("create list")[count] | ||
var quote = '\"' |
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.
You should not use var
, instead use let
or const
.
} | ||
} | ||
|
||
function createObjs(){ |
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.
Prefer explicit than implicit, so instead you could call this function createObjects
.
Also it doesn't seems like this function "only" create objects, it actually creates todos/lists objects, so be more explicit of what the function does in its name.
What type of change does this PR introduce?
Does this PR introduce breaking changes?
List any relevant issue numbers:
Description:
I more thorough test suite for the todo list module. This test suite focuses on scalability, so any number of tests can easily be created for a given module.