Skip to content

test: add unit tests for GsodModalNew#462

Merged
andoriyaprashant merged 1 commit into
andoriyaprashant:mainfrom
adityashirsatrao007:test/gsod-modal-new
Jun 3, 2026
Merged

test: add unit tests for GsodModalNew#462
andoriyaprashant merged 1 commit into
andoriyaprashant:mainfrom
adityashirsatrao007:test/gsod-modal-new

Conversation

@adityashirsatrao007

Copy link
Copy Markdown
Contributor

Description

Adds comprehensive unit tests for the GsodModalNew class (GSoD projects 2021–2023).

Changes

  • Added test/gsod_modal_new_test.dart with 10 test cases covering:
    • Constructor field initialization (11 fields)
    • copyWith() with partial and no-op updates
    • toMap() serialization
    • fromMap() deserialization
    • fromMap() with missing fields (empty string/0 defaults)
    • Equality operator (==)
    • Inequality when fields differ
    • hashCode consistency for equal objects
    • toJson() JSON encoding
    • toString() output

Related Issue

Contributes to #417 (improving test coverage and code quality)

Type of Change

  • New feature (adding tests)

Checklist

  • Tests pass locally
  • Code follows project style guidelines

Comprehensive unit tests for GsodModalNew covering:
- Constructor field initialization (11 fields)
- copyWith() with partial updates
- toMap() serialization
- fromMap() deserialization
- fromMap() with missing fields (empty string defaults)
- Equality operator (==)
- Inequality when fields differ
- hashCode consistency for equal objects
- toJson() JSON encoding
- toString() output
Copilot AI review requested due to automatic review settings May 30, 2026 10:56
@github-actions

Copy link
Copy Markdown

Thank you for submitting your pull request! We'll review it as soon as possible.

@netlify

netlify Bot commented May 30, 2026

Copy link
Copy Markdown

Deploy Preview for aquamarine-kheer-83feda failed. Why did it fail? →

Name Link
🔨 Latest commit 0b3dafb
🔍 Latest deploy log https://app.netlify.com/projects/aquamarine-kheer-83feda/deploys/6a1ac248472f860008db5c51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds unit tests for the GsodModalNew model class, covering its construction, serialization, equality, and utility methods.

Changes:

  • New test file test/gsod_modal_new_test.dart with 11 test cases for GsodModalNew.
  • Tests cover constructor, copyWith, toMap/fromMap, equality/hashCode, toJson, and toString.

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

Comment on lines +5 to +6
group('GsodModalNew', () {
final tModal = GsodModalNew(
Comment on lines +20 to +28
test('constructor sets all fields correctly', () {
expect(tModal.organizationName, 'TestOrg');
expect(tModal.organizationUrl, 'https://testorg.com');
expect(tModal.docsPage, 'Documentation');
expect(tModal.budget, '10000');
expect(tModal.acceptedProjectProposal, 'Test Proposal');
expect(tModal.caseStudy, 'Test Case Study');
expect(tModal.year, 2023);
});
Comment on lines +44 to +50
test('toMap returns correct map', () {
final map = tModal.toMap();
expect(map['organization_name'], 'TestOrg');
expect(map['organization_url'], 'https://testorg.com');
expect(map['budget'], '10000');
expect(map['year'], 2023);
});
Comment on lines +72 to +77
test('fromMap handles missing fields with defaults', () {
final modal = GsodModalNew.fromMap({});
expect(modal.organizationName, '');
expect(modal.budget, '');
expect(modal.year, 0);
});
Comment on lines +38 to +42
test('copyWith with no args returns equivalent object', () {
final copy = tModal.copyWith();
expect(copy.organizationName, tModal.organizationName);
expect(copy.year, tModal.year);
});
Comment on lines +106 to +110
test('toJson returns valid JSON string', () {
final jsonStr = tModal.toJson();
expect(jsonStr, isA<String>());
expect(jsonStr.contains('TestOrg'), isTrue);
});
@andoriyaprashant andoriyaprashant merged commit 8d3584b into andoriyaprashant:main Jun 3, 2026
1 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants