GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — chore: Add initial jest tests + code coverage by bryphe-coder · Pull Request #13 · coder/coder

Conversation

@bryphe-coder

@bryphe-coder bryphe-coder commented Jan 10, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Depends on #8

  • Adds initial infra for running front-end tests (jest, ts-jest, jest.config.js, etc)

TODO:

  • Send up code coverage to codecov
  • Get coverage % threshold over bar

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bryphe-coder bryphe-coder self-assigned this Jan 10, 2022
Base automatically changed from bryphe/prototype/3-port-ui to main January 12, 2022 22:25
@bryphe-coder
Add initial test config
89c44a5
@bryphe-coder
bryphe-coder force-pushed the bryphe/chore/jest-tests branch from 1add80d to 89c44a5 Compare January 12, 2022 22:37
@codecov

codecov Bot commented Jan 12, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

Merging #13 (a633886) into main (afc2fa3) will decrease coverage by 0.06%.
The diff coverage is 36.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #13      +/-   ##
==========================================
- Coverage   70.92%   70.86%   -0.07%     
==========================================
  Files          19       37      +18     
  Lines        1173     1311     +138     
  Branches        0        7       +7     
==========================================
+ Hits          832      929      +97     
- Misses        269      306      +37     
- Partials       72       76       +4     
Flag Coverage Δ
macos-latest ?
ubuntu-latest ?
unittest-go-macos-latest 63.51% <ø> (?)
unittest-go-ubuntu-latest 70.84% <ø> (?)
unittest-go-windows-latest 62.73% <ø> (?)
unittest-js 71.01% <36.36%> (?)
windows-latest ?
Impacted Files Coverage Δ
site/components/Navbar/index.tsx 100.00% <ø> (ø)
site/components/Page/index.tsx 0.00% <0.00%> (ø)
site/pages/_app.tsx 0.00% <0.00%> (ø)
site/pages/index.tsx 0.00% <0.00%> (ø)
site/test_helpers/index.tsx 100.00% <100.00%> (ø)
peer/conn.go 73.70% <0.00%> (-0.31%) ⬇️
site/components/Icons/Logo.tsx 100.00% <0.00%> (ø)
site/theme/theme.tsx 100.00% <0.00%> (ø)
site/theme/palettes.ts 100.00% <0.00%> (ø)
site/components/Button/SplitButton.tsx 89.47% <0.00%> (ø)
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update afc2fa3...a633886. Read the comment docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bryphe-coder added 7 commits January 12, 2022 22:53
@bryphe-coder
Get tests running
37cedc7
@bryphe-coder
Add test step to CI
87cc778
@bryphe-coder
Initial test coverage
93424d6
@bryphe-coder
Upload coverage to codecov
2ba0a8b
@bryphe-coder
Generate coverage files
1d05fa1
@bryphe-coder
Fix file path
6bc94fc
@bryphe-coder
Ignore next.config.js
cad1398
@bryphe-coder
bryphe-coder marked this pull request as ready for review January 13, 2022 00:31
@bryphe-coder
Formatting
d3465d7
@bryphe-coder
bryphe-coder requested a review from kylecarbs January 13, 2022 00:37
kylecarbs
kylecarbs approved these changes Jan 14, 2022
View reviewed changes

@kylecarbs kylecarbs left a comment

Copy link
Copy Markdown
Member

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.

Just a few minor nits!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bryphe-coder reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread jest.config.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread site/components/Button/SplitButton.test.tsx
})

it("is called when clicking option in pop-up", () => {
// Given

@kylecarbs kylecarbs Jan 14, 2022

Copy link
Copy Markdown
Member

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 we confident all tests will follow this pattern? What if there are subsequent given after a when?

I'm hesitant to say we should have these comments in all tests, because I'm not sure how else you'd write the logic anyways.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@bryphe-coder bryphe-coder Jan 14, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

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.

This is a structure we've been using on the front-end (I believe @vapurrmaid introduced it) - in fact one of my first PRs had me add this to tests: https://github.com/coder/m/pull/9720/files#r697678791

Some tests have an extra given / when / then - @vapurrmaid would know some examples of that. Might be nice to have this documented in a front-end code standards page on Notion (our current standards are pretty empty)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@greyscaled greyscaled Jan 19, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.

https://en.wikipedia.org/wiki/Given-When-Then#:~:text=Given%2DWhen%2DThen%20(GWT,to%20write%20down%20test%20cases.&text=When%20describes%20actions%20taken%20by,part%20of%20behavior%2Ddriven%20development.

^ This is a fairly standard pattern.

You're welcome to follow up whens and thens

ie:

// Given - all your givens

// When - thing

// Then - outcome

// When - other thing

// Then - other outcome

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread site/components/Icons/index.test.tsx Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread site/components/Page/index.test.tsx Outdated
import { render } from "../../test_helpers"
import { Page } from "./index"

describe("Page", () => {

@kylecarbs kylecarbs Jan 14, 2022

Copy link
Copy Markdown
Member

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 probably should have reviewed the other PR more thoroughly, but I'm hesitant to have a Page component, because if it were truly to be used on all pages, it would be idiomatic to put it in _app.tsx instead.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@bryphe-coder bryphe-coder Jan 14, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

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.

Ah good point, that <Page /> was leftover before I moved to next. I'll port this over to our _app part of this change.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@bryphe-coder bryphe-coder Jan 14, 2022

Copy link
Copy Markdown
Contributor Author

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.

Removed the <Page /> component here: 7b50658

I still left the Page folder to contain some helper stuff for the page (like the <Footer />) - but we can revisit that folder as we start building out the UI.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
bryphe-coder added 5 commits January 14, 2022 01:50
@bryphe-coder
Use default 'maxWorkers' setting
707f455
@bryphe-coder
Remove page component; inline navbar / footer rendering
7b50658
@bryphe-coder
Formatting
64f8108
@bryphe-coder
Add tests back for Navbar / Footer
dc6f16b
@bryphe-coder
Merge branch 'main' into bryphe/chore/jest-tests
a633886
@bryphe-coder
bryphe-coder merged commit 423611b into main Jan 14, 2022
@bryphe-coder
bryphe-coder deleted the bryphe/chore/jest-tests branch January 14, 2022 02:48
@ketang ketang unassigned bryphe-coder Mar 22, 2022
@bpmct bpmct mentioned this pull request Apr 7, 2022
Review issues and PRs for concerning content #650
Closed
@johnstcn johnstcn mentioned this pull request Mar 24, 2026
feat: add automatic database migration recovery to scripts/develop #23466
Merged
@jscottmiller jscottmiller mentioned this pull request Sep 20, 2026
feat(coderd): add search_chat_messages builtin chatd tool #29616
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@kylecarbs kylecarbs kylecarbs approved these changes
+1 more reviewer
@greyscaled greyscaled greyscaled left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@bryphe-coder @kylecarbs @greyscaled
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.