-
Notifications
You must be signed in to change notification settings - Fork 0
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
Jest Test Suite Set-up and some tests #109
Conversation
] | ||
], | ||
"env": { | ||
"test": { |
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.
hmm, it looks like there's no env stuff being set in the package.json
. Is this being called correctly?
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.
Did some digging and there's no need to set a babel env
in package.json
because Jest will automatically set the env
to test
if it's not provided (per the doc here).
.circleci/config.yml
Outdated
command: npm run lint | ||
- run: | ||
name: Run tests | ||
command: npm run test |
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 should probably use parallelism: 4
and --maxWorkers=4
for jest to make use of it's parallel functionality. There's a good example in the kiln config.
Also, are we checking code coverage (via coveralls/etc) when we run tests?
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.
good idea, will add
"overrides": [ | ||
{ | ||
"files": ["src/**/*.js", "src/**/*.vue"], | ||
"excludedFiles": "*.test.js" |
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.
why are tests excluded from eslint?
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'm linting for TODO
statements, but would like to leave them in tests as a breadcrumb for me or the next developer.
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.
Hmm, I'm worried that this might lead to issues down the line, but 👍 for now
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'll try to remember to lint test files again when we have decent test coverage
src/services/add-service.js
Outdated
@@ -1,6 +1,7 @@ | |||
import { getAvailableComponents, findParentUriAndList } from './utils'; | |||
import { findSpaceLogic } from './create-service'; | |||
import { setNewActive } from '../services/toggle-service'; | |||
import { setNewActiveLogic } from '../services/toggle-service'; | |||
import { last } from 'lodash'; |
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 don't think this will actually tree-shake lodash when all of clay-space-edit is compiled, will 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.
ahh I think you're right, webpack is not doing any tree-shaking. Will investigate
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.
K, added Lodash tree-shaking
src/services/create-service.js
Outdated
@@ -99,7 +101,8 @@ function componentToSpace(store, ref, parentRef, spaceName) { | |||
] | |||
}); | |||
}) | |||
.catch(function () { | |||
.catch(function (res) { | |||
console.log(res); |
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.
extra console log?
src/services/toggle-service.js
Outdated
if (activeUri) { | ||
dom.find(`[data-uri="${activeUri}"]`).setAttribute(activeAttr, ''); | ||
} | ||
console.log('foo'); |
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.
extra console.log?
dispatchCalls = []; | ||
}); | ||
|
||
// TODO: these tests are WIP |
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.
are these going to be a part of this PR, or a separate one?
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.
going to be a separate one
related to #20 |
This reverts commit c9b1f63.
We do cherry-picking in Kiln, but I think that requires doing |
lolo oops forgot to merge this in |
related #20
This PR includes:
add
,create
,remove
,toggle
serviceslodash
The kind of feedback I'm looking for:
Notes:
You'll notice that a lot of tests are asserting if a
dispatch
object is being defined correctly.clay-space-edit
is a plugin that hooks into Kiln's Vuex (the thing we're using do state management in Kiln) store and in order to trigger things that Kiln handles (like updating components),clay-space-edit
sends a dispatch to trigger actions. Instead of mocking all of Vuex, I'm just sending dispatches to an array, here