In api/feeder_test.go, we have three main test case scenarios:
- To test if a unique hash is generated for each new document
- Testing if payload sent to the /api/feeder endpoint returns document content as expected
- Test to ensure the indexing of documents is working as expected
The following is the expected output after running the tests:
$ go test -v ./... ? github.com/last-ent/distributed-go/chapter6/goophr/concierge [no test files] === RUN TestGetTitleHash === RUN TestGetTitleHash/Different_Titles === RUN TestGetTitleHash/Duplicate_Titles === RUN TestGetTitleHash/Same_hashes --- PASS: TestGetTitleHash (0.00s) --- PASS: TestGetTitleHash/Different_Titles (0.00s) --- PASS: TestGetTitleHash/Duplicate_Titles (0.00s) --- PASS: TestGetTitleHash/Same_hashes (0.00s) === RUN TestGetFile --- PASS: TestGetFile (0.00s) === RUN TestIndexProcessor === RUN TestIndexProcessor/Testing_if_'golang'_is_returned._at_index:_1 === RUN TestIndexProcessor/Testing_if_'programming'_is_returned._at_index:_2 === RUN TestIndexProcessor/Testing_if_'rocks'_is_returned._at_index:_3 --- PASS: TestIndexProcessor (0.00s) --- PASS: TestIndexProcessor/Testing_if_'golang'_is_returned._at_index:_1 (0.00s) --- PASS: TestIndexProcessor/Testing_if_'programming'_is_returned._at_index:_2 (0.00s) --- PASS: TestIndexProcessor/Testing_if_'rocks'_is_returned._at_index:_3 (0.00s) PASS ok github.com/last-ent/distributed-go/chapter6/goophr/concierge/api 0.004s ? github.com/last-ent/distributed-go/chapter6/goophr/concierge/common [no test files]