No description
Find a file
Snider 32f1d0ab5d Feature add tdd core tests (#22)
* feat: Add TDD tests for core package

Adds a new `tdd/` directory for TDD-style contract tests.

Implements a comprehensive test suite for the `pkg/core` package, covering:
- `New()`
- `WithService()`
- `WithName()`
- `WithWails()`
- `WithAssets()`
- `WithServiceLock()`
- `RegisterService()`
- `Service()`
- `ServiceFor()`
- `MustServiceFor()`
- `ACTION()`
- `RegisterAction()`
- `RegisterActions()`

To support testing, a public `Assets()` method was added to the `Core` struct.

* feat: Add TDD tests for e, io, runtime, and config packages

Adds comprehensive TDD tests to the `tdd/` directory for the following packages:
- `pkg/e`
- `pkg/io`
- `pkg/runtime`
- `pkg/config`

This significantly improves the test coverage of the project.

To support testing the `runtime` package, the `newWithFactories` function was exported as `NewWithFactories`.

The existing tests for the `config` package were moved from the `internal` package to the `tdd/` directory and adapted to use the public API.

* fix: Update tdd tests for config, core, and runtime

Updates the TDD tests for the `config`, `core`, and `runtime` packages to improve their coverage and correctness.

- In `tdd/config_test.go`, the `TestIsFeatureEnabled` test is updated to use `s.Set` to modify the `features` slice, ensuring that the persistence logic is exercised.
- In `tdd/core_test.go`, the `TestCore_WithAssets_Good` test is updated to use a real embedded filesystem with `//go:embed` to verify the contents of a test file.
- In `tdd/runtime_test.go`, the `TestNew_Good` test is converted to a table-driven test to cover the happy path, error cases, and a case with a non-nil `application.App`.

* fix: Fix build and improve test coverage

This commit fixes a build failure in the `pkg/runtime` tests and significantly improves the test coverage for several packages.

- Fixes a build failure in `pkg/runtime/runtime_test.go` by updating a call to an exported function.
- Moves TDD tests for `config` and `e` packages into their respective package directories to ensure accurate coverage reporting.
- Adds a new test suite for the `pkg/i18n` package, including a test helper to inject a mock i18n bundle.
- Moves and updates tests for the `pkg/crypt` package to use its public API.
- The coverage for `config` and `e` is now 100%.
- The coverage for `crypt` and `i18n` has been significantly improved.

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-11-02 22:29:17 +00:00
.github/workflows Add Codecov upload step in coverage workflow (#23) 2025-11-02 22:06:05 +00:00
cmd restores gui 2025-11-02 18:04:58 +00:00
docs Add CNAME file for custom domain 2025-11-02 16:29:45 +00:00
pkg Feature add tdd core tests (#22) 2025-11-02 22:29:17 +00:00
tdd Feature add tdd core tests (#22) 2025-11-02 22:29:17 +00:00
.gitignore Refactor PGP module with helper functions and error handling title (#8) 2025-10-30 14:18:37 +00:00
go.mod Refactor library improvements (#18) 2025-11-02 16:17:25 +00:00
go.sum Refactor library improvements (#18) 2025-11-02 16:17:25 +00:00
go.work Refactor service documentation to standardize naming conventions and improve clarity 2025-10-28 12:06:24 +00:00
go.work.sum restores gui 2025-11-02 18:04:58 +00:00
LICENSE.txt Add initial project structure with core functionality and basic files 2025-10-24 04:55:10 +01:00
Makefile Add pre-commit task, CLI enhancements, and ATS updates 2025-10-27 05:41:11 +00:00
mkdocs.yml Refactor library improvements (#18) 2025-11-02 16:17:25 +00:00
README.md Add Codecov badge to README 2025-11-02 22:07:45 +00:00
Taskfile.yml (#10) GitHub Actions workflow and refactor build and test infrastructure 2025-10-30 16:23:00 +00:00

Core

codecov

Core is a Web3 Framework, written in Go using Wails.io to replace Electron and the bloat of browsers that, at their core, still live in their mum's basement.

More to come, follow us on Discord http://discord.dappco.re

Repo: https://github.com/Snider/Core

Quick start

import core "github.com/Snider/Core"

app := core.New(
  core.WithServiceLock(),
)

Development Workflow

This project follows a Test-Driven Development (TDD) approach. We use Task for task automation to streamline the development process.

The recommended workflow is:

  1. Generate Tests: For any changes to the public API, first generate the necessary test stubs.

    task test-gen
    
  2. Run Tests (and watch them fail): Verify that the new tests fail as expected.

    task test
    
  3. Implement Your Feature: Write the code to make the tests pass.

  4. Run Tests Again: Ensure all tests now pass.

    task test
    
  5. Submit for Review: Once your changes are complete and tests are passing, submit them for a CodeRabbit review.

    task review
    

Project Structure

The project is organized into the following main directories:

  • pkg/: Contains the core Go packages that make up the framework.
  • cmd/: Contains the entry points for the two main applications:
    • core-gui/: The Wails-based GUI application.
    • core/: The command-line interface (CLI) application.

Prerequisites

Building and Running

GUI Application

To run the GUI application in development mode:

task gui:dev

To build the final application for your platform:

task gui:build

CLI Application

To build the CLI application:

task cli:build

The executable will be located in the cmd/core/bin directory.

Available Tasks

To run any of the following tasks, open your terminal in the project's root directory and execute the task command.

General Tasks

  • task test: Runs all Go tests recursively for the entire project.
  • task test-gen: Generates tests for the public API.
  • task check: A comprehensive check that runs go mod tidy, the full test suite, and a CodeRabbit review.
  • task review: Submits the current changes for a CodeRabbit review.
  • task cov: Generates a test coverage profile (coverage.txt).
  • task cov-view: Opens the HTML coverage report in your browser.
  • task sync: Updates the public API Go files to match the exported interface of the modules.

GUI Application (cmd/core-gui)

These tasks are run from the root directory and operate on the GUI application.

  • task gui:build: Builds the GUI application.
  • task gui:package: Packages a production build of the GUI application.
  • task gui:run: Runs the GUI application.
  • task gui:dev: Runs the GUI application in development mode, with hot-reloading enabled.

CLI Application (cmd/core)

These tasks are run from the root directory and operate on the CLI application.

  • task cli:build: Builds the CLI application.
  • task cli:build:dev: Builds the CLI application for development.
  • task cli:run: Builds and runs the CLI application.
  • task cli:sync: Updates the public API Go files.
  • task cli:test-gen: Generates tests for the public API.

Docs (MkDocs)

The help site and inapp docs are built with MkDocs Material and live under pkg/v1/core/docs.

  • Live preview: from pkg/v1/core/docs run
    • pip install -r requirements.txt
    • mkdocs serve -o -c (or task dev if you use Task)
  • Build static site: mkdocs build --clean -d public (or task build)

The demo app embeds the built docs from public/ and can open specific sections in new windows using stable, short headings.