1package repositories_test
2
3import (
4	"fmt"
5	cst "repodiff/constants"
6	ent "repodiff/entities"
7	repoSQL "repodiff/persistence/sql"
8)
9
10func fakeFixtures() []ent.AnalyzedDiffRow {
11	return []ent.AnalyzedDiffRow{
12		ent.AnalyzedDiffRow{
13			DiffRow: ent.DiffRow{
14				Date:                 "2018/02/20",
15				DownstreamProject:    "platform/vendor/unbundled_google/packages/Ears",
16				UpstreamProject:      "platform/vendor/unbundled_google/packages/Ears",
17				DiffStatus:           3,
18				FilesChanged:         34,
19				LineInsertions:       8,
20				LineDeletions:        25,
21				LineChanges:          32,
22				CommitsNotUpstreamed: 0,
23			},
24			Type: cst.Empty,
25		},
26	}
27}
28
29func fakeCommitFixtures() []ent.AnalyzedCommitRow {
30	return []ent.AnalyzedCommitRow{
31		ent.AnalyzedCommitRow{
32			CommitRow: ent.CommitRow{
33				Date:              "2018/02/20",
34				Commit:            "61d5e61b6b6dfbf52d0d433759da964db31cc106",
35				DownstreamProject: "platform/vendor/unbundled_google/packages/Ears",
36				Author:            "[email protected]",
37				// Actual commit subject!
38				Subject: "Import translations. DO NOT MERGE",
39			},
40			Type: cst.Empty,
41		},
42	}
43}
44
45func clearTableBeforeAfterTest(tableName string) func() {
46	clearTable(tableName)
47	return func() {
48		clearTable(tableName)
49	}
50}
51
52func clearTable(tableName string) {
53	db, _ := repoSQL.GetDBConnectionPool()
54	db.Exec(
55		fmt.Sprintf("TRUNCATE TABLE %s", tableName),
56	)
57}
58