Skip to content
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

test: add unit tests for getSchemaAppEnsuringOrganization #646

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

rossiam
Copy link
Collaborator

@rossiam rossiam commented Nov 18, 2024

  • Added unit test for new getSchemaAppEnsuringOrganization function.
  • Removed unnecessary generic specification for APICommand (which already default to APICommandFlags).

@rossiam rossiam requested a review from a team November 18, 2024 22:26
Copy link

changeset-bot bot commented Nov 18, 2024

⚠️ No Changeset found

Latest commit: f9c45de

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

import type { clipToMaximum, fatalError } from '../../../../lib/util.js'
import type { APICommand } from '../../../../lib/command/api-command.js'
import type { chooseOrganization, organizationDef } from '../../../../lib/command/util/organizations-util.js'
import { chooseOrganization, organizationDef } from '../../../../lib/command/util/organizations-util.js'
Copy link
Contributor

Choose a reason for hiding this comment

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

Here and on line 14 (import type { stdinIsTTY, stdoutIsTTY }...) the import statement isn't what I expected with regard to type and not type

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I missed type on a bunch of things here. Fixed now.

expect(cloneMock).not.toHaveBeenCalled()
})

it('sets and organization when app found without an organization', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Little typo: "an organization"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch. Fixed.

it('sets and organization when app found without an organization', async () => {
chooseOrganizationMock.mockResolvedValueOnce('organization-id-1')
apiOrganizationsGetMock.mockResolvedValueOnce(organization1)
// TODO: maybe use an "updated organization" here and in corresponding expect below
Copy link
Contributor

Choose a reason for hiding this comment

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

Just checking: this TODO is really for future work and not just an idea that you considered and rejected, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Didn't mean to leave that in. Removed now.

@rossiam rossiam force-pushed the new-schema-utils-tests branch from 7ebda67 to f9c45de Compare November 19, 2024 16:15
@rossiam rossiam merged commit e1ee537 into SmartThingsCommunity:yargs Nov 19, 2024
4 checks passed
@rossiam rossiam deleted the new-schema-utils-tests branch November 19, 2024 16:18
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.

2 participants