Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

test: mongodoc testing #61

Merged
merged 2 commits into from
Oct 23, 2021
Merged

test: mongodoc testing #61

merged 2 commits into from
Oct 23, 2021

Conversation

mimoham24
Copy link
Contributor

Overview

What I've done

What I haven't done

How I tested

Which point I want you to review particularly

Memo

@codecov
Copy link

codecov bot commented Oct 11, 2021

Codecov Report

❗ No coverage uploaded for pull request base (tag-system@e1289e0). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@              Coverage Diff              @@
##             tag-system      #61   +/-   ##
=============================================
  Coverage              ?   16.21%           
=============================================
  Files                 ?      269           
  Lines                 ?    44276           
  Branches              ?        0           
=============================================
  Hits                  ?     7181           
  Misses                ?    36082           
  Partials              ?     1013           

Copy link
Member

@rot1024 rot1024 left a comment

Choose a reason for hiding this comment

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

Test codes is fine, but why not use testify/assert?

Comment on lines 315 to 325
got, got1, err := d.Model()
if (err != nil) != tc.wantErr {
t.Errorf("Model() error = %v, wantErr %v", err, tc.wantErr)
return
}
if !reflect.DeepEqual(got, tc.want) {
t.Errorf("Model() got = %v, want %v", got, tc.want)
}
if !reflect.DeepEqual(got1, tc.want1) {
t.Errorf("Model() got1 = %v, want %v", got1, tc.want1)
}
Copy link
Member

Choose a reason for hiding this comment

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

1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rot1024 those test cases are generated by the command you mentioned previously on slack

Copy link
Member

Choose a reason for hiding this comment

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

Of course, automatic generation of test code is great, but it doesn't mean that you don't have to modify it to match the rest of the Re:Earth code.

Comment on lines 492 to 498
if (err != nil) != tc.wantErr {
t.Errorf("ModelItem() error = %v, wantErr %v", err, tc.wantErr)
return
}
if !reflect.DeepEqual(got, tc.want) {
t.Errorf("ModelItem() got = %v, want %v", got, tc.want)
}
Copy link
Member

Choose a reason for hiding this comment

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

Comment on lines 409 to 415
if (err != nil) != tc.wantErr {
t.Errorf("ModelGroup() error = %v, wantErr %v", err, tc.wantErr)
return
}
if !reflect.DeepEqual(got, tc.want) {
t.Errorf("ModelGroup() got = %v, want %v", got, tc.want)
}
Copy link
Member

Choose a reason for hiding this comment

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

ItemRows: tc.fields.ItemRows,
}
if err := c.Consume(tc.args.raw); (err != nil) != tc.wantErr {
t.Errorf("Consume() error = %v, wantErr %v", err, tc.wantErr)
Copy link
Member

Choose a reason for hiding this comment

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

4

@mimoham24 mimoham24 merged commit 52658ba into tag-system Oct 23, 2021
@mimoham24 mimoham24 deleted the tag/mongo-testing branch October 23, 2021 21:54
mimoham24 added a commit that referenced this pull request Oct 25, 2021
* feat: tag system domain models (#39)

* feat: tag system domain models

* refactor: * add tag interface * tag -> group and tag->item conversation

* testing: generate test cases for the tagID

* resolve notes

* fix unit tests errors

* add NewId test code
fix NewId func

* add more test cases
refactor some parts

* feat: tag system data-layer (mongo) (#44)

* feat: tag system data-layer (mongo)

* remove len > 0 check

* goimport

* Update pkg/tag/group_builder.go

Co-authored-by: rot1024 <aayhrot@gmail.com>

* Update pkg/tag/item_builder.go

Co-authored-by: rot1024 <aayhrot@gmail.com>

* rename itemFrom and groupFrom funcs

Co-authored-by: rot1024 <aayhrot@gmail.com>

* feat: create tag group and tag item (#45)

* tag item and group schema

* feat: creat tags (GQL schema)

* tag items and tag groups resolvers

* datalayer (dummy memory) and usecases

* receive list by reference

* check if nil for list

* resolve notes

* generate new models

* feat: memory infrastructure (#46)

* refactor: implement memory infrastructure

* test: implement memory infrastructure test cases

* test: fix FindByScene test case

* feat: attach/detach tag from layer (#50)

* tag item and group schema

* feat: creat tags (GQL schema)

* tag items and tag groups resolvers

* datalayer (dummy memory) and usecases

* receive list by reference

* check if nil for list

* feat: introduce tags to layers

* feat: attach/detach tags from layers

* fix imports

* refactor: resolve notes

* test: test units for tags

* refactor: resolve notes

* feat: attach/detach tag item from group (#52)

* refactor: transform group tags list to reference

* feat: attach/detach tags

* refactor: use params as use-case input

* test: mongodoc testing (#61)

* test: mongodoc testing

* resolve notes

* feat: remove tag (#58)

* feat: remove a tag (init)

* feat: remove tag

* feat: remove tag usecase and infra

* resolve notes

* feat: tag system queries (#54)

* feat: tag system queries

* resolve notes

* feat: update tag (#49)

* tag item and group schema

* feat: creat tags (GQL schema)

* tag items and tag groups resolvers

* datalayer (dummy memory) and usecases

* receive list by reference

* check if nil for list

* feat: rename tag group

* refactor: rename -> update

* resolve notes

* resolve notes

* change find by id func return type

* Merge branch 'tag-system' of https://github.com/reearth/reearth-backend into tag/update-group-label

# Conflicts:
#	internal/adapter/gql/generated.go
#	internal/adapter/gql/gqlmodel/convert_tag.go

* fix testing

* resolve notes

* resolve notes

* resolve notes

Co-authored-by: HideBa <baba.papa1120.ba@gmail.com>
Co-authored-by: rot1024 <aayhrot@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants