Skip to content

New unit tests for singleCellCellType & singleCellGeneExpression tws#4300

Merged
xzhou82 merged 2 commits intomasterfrom
sc-tw-tests
Mar 12, 2026
Merged

New unit tests for singleCellCellType & singleCellGeneExpression tws#4300
xzhou82 merged 2 commits intomasterfrom
sc-tw-tests

Conversation

@creilly8
Copy link
Collaborator

@creilly8 creilly8 commented Mar 11, 2026

Description

Not urgent. Started new unit test files for tw/singleCellCellType.ts and tw/singleCellGeneExpression.ts

Supports efforts detailed in SC roadmap

Checklist

Check each task that has been performed or verified to be not applicable.

  • Tests: Added and/or passed unit and integration tests, or N/A
  • Todos: Commented or documented, or N/A
  • Notable Changes: updated release.txt, prefixed a commit message with "fix:" or "feat:", added to an internal tracking document, or N/A
  • Rust: Checked to see whether Rust needs to be re-compiled because of this PR, or N/A

Copilot AI review requested due to automatic review settings March 11, 2026 22:27
@creilly8 creilly8 requested a review from xzhou82 March 11, 2026 22:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds initial unit test coverage for the new single-cell termwrapper implementations and aligns termwrapper term.type constants with the shared TermTypes enum-like map.

Changes:

  • Added new unit test specs for tw/singleCellCellType and tw/singleCellGeneExpression.
  • Updated single-cell termwrapper modules to use TermTypes.* instead of hardcoded strings.
  • Tightened singleCellGeneExpression validation to handle null terms.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
release.txt Notes the addition of unit tests in the release log.
client/tw/test/singleCellGeneExpression.unit.spec.ts Adds unit tests for getSCGEunit(), validate(), fill(), and constructor behavior.
client/tw/test/singleCellCellType.unit.spec.ts Adds unit tests for validate(), fill(), and constructor defaults.
client/tw/singleCellGeneExpression.ts Switches to TermTypes.SINGLECELL_GENE_EXPRESSION and improves null checking in validate().
client/tw/singleCellCellType.ts Switches to a TermTypes constant for termType (but currently uses a non-existent key).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

import { TermTypes } from '#shared/terms.js'

const termType = 'singleCellCellType'
const termType = TermTypes.SINGLECELL_CELL_TYPE
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TermTypes does not define SINGLECELL_CELL_TYPE (the existing constant is TermTypes.SINGLECELL_CELLTYPE: 'singleCellCellType'). As written, termType will be undefined, which breaks validation/type checks and can let invalid terms pass silently. Update this to use the correct TermTypes key so termType resolves to 'singleCellCellType'.

Suggested change
const termType = TermTypes.SINGLECELL_CELL_TYPE
const termType = TermTypes.SINGLECELL_CELLTYPE

Copilot uses AI. Check for mistakes.

function getValidRawTerm(overrides: any = {}) {
return {
type: TermTypes.SINGLECELL_CELL_TYPE,
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are using TermTypes.SINGLECELL_CELL_TYPE, but TermTypes defines SINGLECELL_CELLTYPE (no _TYPE). Using the non-existent key makes term.type undefined, which can cause these tests to pass even while the implementation is broken. Replace all occurrences with TermTypes.SINGLECELL_CELLTYPE and consider asserting the expected type string in the thrown error message to prevent this class of regression.

Suggested change
type: TermTypes.SINGLECELL_CELL_TYPE,
type: TermTypes.SINGLECELL_CELLTYPE,

Copilot uses AI. Check for mistakes.
@xzhou82 xzhou82 merged commit d4d89b3 into master Mar 12, 2026
1 check passed
@xzhou82 xzhou82 deleted the sc-tw-tests branch March 12, 2026 01:43
compbiolover pushed a commit that referenced this pull request Mar 12, 2026
…4300)

Co-authored-by: xzhou82 <1619109+xzhou82@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants