Skip to content

Commit

Permalink
Refactor learn markdown subcommands into Cobra Commands with tests (#128
Browse files Browse the repository at this point in the history
)

* Refactor learn markdown subcommands into Cobra Commands with tests

NOTE: This refactor leaves the entire CLI usage exactly the same.
      The only difference is that the help messages for learn
      markdown are much more thorough.

This refactor moves all learn markdown commands into their own
files and Cobra Commands. The common flags for all markdown
commands are put into the PersistentFlags of the markdown
command object. Those flags are then accessible to all child
commands.

The newly-implemented flags for questions/challenges are now
only defined for the markdown subcommands in the "questions"
group.

The markdown subcommand-specific help messages now contain the
same introductory text that can be found in the Learn
Documentation cohort. (https://learn-2.galvanize.com/cohorts/667)

The orthogonal interest of how to write output to a destination
(clipboard, stdout, append) has also been refactored into its
own package (templates). This allows for independent testing
of the methods of writing.

The refactor necessitated the upgrade of the Cobra library to
the most recent version.

Because of this refactor, it is now possible to test markdown
subcommands in isolation, not only their configuration, but
also the way the execute. This has allowed for nearly 100%
coverage of all Markdown-related code in the CLI.

* Bump the Go version in tests for gomock.

* Move clipboard test to integration test

* Address error in descyaml generator

The description.yaml file needs UID replacement. This commit
addresses that.

[x] Unit test created to demonstrate the problem
[x] YAML command parameter added to indicate the need of a UID
[x] `createYamlCommand` updated to use the new flag
[x] New flag explicitly set in all YAML commands

---------

Co-authored-by: Curtis Schlak <156-curtis@users.noreply.gitlab.galvanize.com>
  • Loading branch information
realistschuckle and Curtis Schlak authored Mar 9, 2024
1 parent d21f10e commit 04602e4
Show file tree
Hide file tree
Showing 53 changed files with 3,993 additions and 1,950 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.17.x]
go-version: [1.22.x]
platform: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand Down
195 changes: 0 additions & 195 deletions app/cmd/challenge_attributes_test.go

This file was deleted.

Loading

0 comments on commit 04602e4

Please sign in to comment.