@into-cps-association/libms 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +9 -0
- package/.eslintignore +6 -0
- package/.eslintrc +53 -0
- package/.madgerc +18 -0
- package/.prettierrc +4 -0
- package/API.md +211 -0
- package/DEVELOPER.md +60 -0
- package/LICENSE.md +301 -0
- package/README.md +119 -0
- package/dist/src/app.module.d.ts +2 -0
- package/dist/src/app.module.js +36 -0
- package/dist/src/app.module.js.map +1 -0
- package/dist/src/bootstrap.d.ts +6 -0
- package/dist/src/bootstrap.js +27 -0
- package/dist/src/bootstrap.js.map +1 -0
- package/dist/src/files/files.module.d.ts +2 -0
- package/dist/src/files/files.module.js +27 -0
- package/dist/src/files/files.module.js.map +1 -0
- package/dist/src/files/interfaces/files.service.interface.d.ts +5 -0
- package/dist/src/files/interfaces/files.service.interface.js +3 -0
- package/dist/src/files/interfaces/files.service.interface.js.map +1 -0
- package/dist/src/files/queries.d.ts +2 -0
- package/dist/src/files/queries.js +47 -0
- package/dist/src/files/queries.js.map +1 -0
- package/dist/src/files/resolvers/files.resolver.d.ts +8 -0
- package/dist/src/files/resolvers/files.resolver.js +49 -0
- package/dist/src/files/resolvers/files.resolver.js.map +1 -0
- package/dist/src/files/services/files-service.factory.d.ts +11 -0
- package/dist/src/files/services/files-service.factory.js +48 -0
- package/dist/src/files/services/files-service.factory.js.map +1 -0
- package/dist/src/files/services/gitlab-files.service.d.ts +12 -0
- package/dist/src/files/services/gitlab-files.service.js +65 -0
- package/dist/src/files/services/gitlab-files.service.js.map +1 -0
- package/dist/src/files/services/local-files.service.d.ts +11 -0
- package/dist/src/files/services/local-files.service.js +77 -0
- package/dist/src/files/services/local-files.service.js.map +1 -0
- package/dist/src/main.d.ts +2 -0
- package/dist/src/main.js +20 -0
- package/dist/src/main.js.map +1 -0
- package/dist/src/types.d.ts +43 -0
- package/dist/src/types.js +181 -0
- package/dist/src/types.js.map +1 -0
- package/dist/test/e2e/app.e2e.spec.d.ts +1 -0
- package/dist/test/e2e/app.e2e.spec.js +36 -0
- package/dist/test/e2e/app.e2e.spec.js.map +1 -0
- package/dist/test/integration/files.service.integration.spec.d.ts +1 -0
- package/dist/test/integration/files.service.integration.spec.js +53 -0
- package/dist/test/integration/files.service.integration.spec.js.map +1 -0
- package/dist/test/testUtil.d.ts +88 -0
- package/dist/test/testUtil.js +182 -0
- package/dist/test/testUtil.js.map +1 -0
- package/dist/test/unit/files-service.factory.unit.spec.d.ts +1 -0
- package/dist/test/unit/files-service.factory.unit.spec.js +40 -0
- package/dist/test/unit/files-service.factory.unit.spec.js.map +1 -0
- package/dist/test/unit/files.resolver.unit.spec.d.ts +1 -0
- package/dist/test/unit/files.resolver.unit.spec.js +56 -0
- package/dist/test/unit/files.resolver.unit.spec.js.map +1 -0
- package/dist/test/unit/gitlab-files.service.unit.spec.d.ts +1 -0
- package/dist/test/unit/gitlab-files.service.unit.spec.js +37 -0
- package/dist/test/unit/gitlab-files.service.unit.spec.js.map +1 -0
- package/dist/test/unit/local-files.service.unit.spec.d.ts +1 -0
- package/dist/test/unit/local-files.service.unit.spec.js +84 -0
- package/dist/test/unit/local-files.service.unit.spec.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/jest.config.json +30 -0
- package/nest-cli.json +8 -0
- package/package.json +71 -0
- package/src/app.module.ts +24 -0
- package/src/bootstrap.ts +29 -0
- package/src/files/files.module.ts +15 -0
- package/src/files/interfaces/files.service.interface.ts +7 -0
- package/src/files/queries.ts +42 -0
- package/src/files/resolvers/files.resolver.ts +23 -0
- package/src/files/services/files-service.factory.ts +27 -0
- package/src/files/services/gitlab-files.service.ts +65 -0
- package/src/files/services/local-files.service.ts +76 -0
- package/src/main.ts +27 -0
- package/src/schema.gql +58 -0
- package/src/types.ts +92 -0
- package/test/README.md +33 -0
- package/test/coverage/clover.xml +40 -0
- package/test/coverage/coverage-final.json +2 -0
- package/test/coverage/lcov-report/base.css +224 -0
- package/test/coverage/lcov-report/block-navigation.js +87 -0
- package/test/coverage/lcov-report/favicon.png +0 -0
- package/test/coverage/lcov-report/index.html +116 -0
- package/test/coverage/lcov-report/prettify.css +1 -0
- package/test/coverage/lcov-report/prettify.js +2 -0
- package/test/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/test/coverage/lcov-report/sorter.js +196 -0
- package/test/coverage/lcov-report/testUtil.ts.html +655 -0
- package/test/coverage/lcov.info +52 -0
- package/test/data/user2/data/.gitkeep +0 -0
- package/test/data/user2/digital_twins/.gitkeep +0 -0
- package/test/data/user2/functions/.gitkeep +0 -0
- package/test/data/user2/models/.gitkeep +0 -0
- package/test/data/user2/tools/.gitkeep +0 -0
- package/test/data/user2/tools/README.md +1 -0
- package/test/e2e/app.e2e.spec.ts +79 -0
- package/test/integration/files.service.integration.spec.ts +67 -0
- package/test/jest-e2e.json +9 -0
- package/test/starttraefik.bash +11 -0
- package/test/stoptraefik.bash +9 -0
- package/test/testUtil.ts +190 -0
- package/test/unit/files-service.factory.unit.spec.ts +46 -0
- package/test/unit/files.resolver.unit.spec.ts +70 -0
- package/test/unit/gitlab-files.service.unit.spec.ts +46 -0
- package/test/unit/local-files.service.unit.spec.ts +108 -0
- package/tsconfig.json +31 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":";;;AACA,yCAAoC;AACpC,2CAAoC;AAMpC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,WAAW,CACV,4LAA4L,CAC7L;KACA,MAAM,CAAC,qBAAqB,EAAE,oCAAoC,CAAC;KACnE,UAAU,CAAC,YAAY,EAAE,wBAAwB,CAAC;KAClD,kBAAkB,EAAE,CAAC;AAExB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5B,MAAM,OAAO,GAAmB,OAAO,CAAC,IAAI,EAAE,CAAC;AAE/C,IAAI,OAAO,CAAC,MAAM,EAAE;IAClB,IAAA,mBAAS,EAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;CACtE;KAAM;IACL,IAAA,mBAAS,EAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;CAC9C"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare class Blob {
|
|
2
|
+
name: string;
|
|
3
|
+
type: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class BlobEdge {
|
|
6
|
+
node: Blob;
|
|
7
|
+
}
|
|
8
|
+
export declare class BlobConnection {
|
|
9
|
+
edges: BlobEdge[];
|
|
10
|
+
}
|
|
11
|
+
export declare class TreeEntry {
|
|
12
|
+
name: string;
|
|
13
|
+
type: string;
|
|
14
|
+
}
|
|
15
|
+
export declare class TreeEdge {
|
|
16
|
+
node: TreeEntry;
|
|
17
|
+
}
|
|
18
|
+
export declare class TreeConnection {
|
|
19
|
+
edges: TreeEdge[];
|
|
20
|
+
}
|
|
21
|
+
export declare class Tree {
|
|
22
|
+
blobs: BlobConnection;
|
|
23
|
+
trees: TreeConnection;
|
|
24
|
+
}
|
|
25
|
+
export declare class RepositoryBlob {
|
|
26
|
+
name: string;
|
|
27
|
+
rawBlob: string;
|
|
28
|
+
rawTextBlob: string;
|
|
29
|
+
}
|
|
30
|
+
export declare class RepositoryBlobConnection {
|
|
31
|
+
nodes: RepositoryBlob[];
|
|
32
|
+
}
|
|
33
|
+
export declare class Repository {
|
|
34
|
+
tree?: Tree;
|
|
35
|
+
blobs?: RepositoryBlobConnection;
|
|
36
|
+
}
|
|
37
|
+
export declare class Project {
|
|
38
|
+
repository: Repository;
|
|
39
|
+
}
|
|
40
|
+
export declare class Query {
|
|
41
|
+
listDirectory: Project;
|
|
42
|
+
readFile: Project;
|
|
43
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Query = exports.Project = exports.Repository = exports.RepositoryBlobConnection = exports.RepositoryBlob = exports.Tree = exports.TreeConnection = exports.TreeEdge = exports.TreeEntry = exports.BlobConnection = exports.BlobEdge = exports.Blob = void 0;
|
|
13
|
+
const graphql_1 = require("@nestjs/graphql");
|
|
14
|
+
let Blob = class Blob {
|
|
15
|
+
name;
|
|
16
|
+
type;
|
|
17
|
+
};
|
|
18
|
+
exports.Blob = Blob;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, graphql_1.Field)(),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], Blob.prototype, "name", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, graphql_1.Field)(),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], Blob.prototype, "type", void 0);
|
|
27
|
+
exports.Blob = Blob = __decorate([
|
|
28
|
+
(0, graphql_1.ObjectType)()
|
|
29
|
+
], Blob);
|
|
30
|
+
let BlobEdge = class BlobEdge {
|
|
31
|
+
node;
|
|
32
|
+
};
|
|
33
|
+
exports.BlobEdge = BlobEdge;
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, graphql_1.Field)(() => Blob),
|
|
36
|
+
__metadata("design:type", Blob)
|
|
37
|
+
], BlobEdge.prototype, "node", void 0);
|
|
38
|
+
exports.BlobEdge = BlobEdge = __decorate([
|
|
39
|
+
(0, graphql_1.ObjectType)()
|
|
40
|
+
], BlobEdge);
|
|
41
|
+
let BlobConnection = class BlobConnection {
|
|
42
|
+
edges;
|
|
43
|
+
};
|
|
44
|
+
exports.BlobConnection = BlobConnection;
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, graphql_1.Field)(() => [BlobEdge]),
|
|
47
|
+
__metadata("design:type", Array)
|
|
48
|
+
], BlobConnection.prototype, "edges", void 0);
|
|
49
|
+
exports.BlobConnection = BlobConnection = __decorate([
|
|
50
|
+
(0, graphql_1.ObjectType)()
|
|
51
|
+
], BlobConnection);
|
|
52
|
+
let TreeEntry = class TreeEntry {
|
|
53
|
+
name;
|
|
54
|
+
type;
|
|
55
|
+
};
|
|
56
|
+
exports.TreeEntry = TreeEntry;
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, graphql_1.Field)(),
|
|
59
|
+
__metadata("design:type", String)
|
|
60
|
+
], TreeEntry.prototype, "name", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, graphql_1.Field)(),
|
|
63
|
+
__metadata("design:type", String)
|
|
64
|
+
], TreeEntry.prototype, "type", void 0);
|
|
65
|
+
exports.TreeEntry = TreeEntry = __decorate([
|
|
66
|
+
(0, graphql_1.ObjectType)()
|
|
67
|
+
], TreeEntry);
|
|
68
|
+
let TreeEdge = class TreeEdge {
|
|
69
|
+
node;
|
|
70
|
+
};
|
|
71
|
+
exports.TreeEdge = TreeEdge;
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, graphql_1.Field)(() => TreeEntry),
|
|
74
|
+
__metadata("design:type", TreeEntry)
|
|
75
|
+
], TreeEdge.prototype, "node", void 0);
|
|
76
|
+
exports.TreeEdge = TreeEdge = __decorate([
|
|
77
|
+
(0, graphql_1.ObjectType)()
|
|
78
|
+
], TreeEdge);
|
|
79
|
+
let TreeConnection = class TreeConnection {
|
|
80
|
+
edges;
|
|
81
|
+
};
|
|
82
|
+
exports.TreeConnection = TreeConnection;
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, graphql_1.Field)(() => [TreeEdge]),
|
|
85
|
+
__metadata("design:type", Array)
|
|
86
|
+
], TreeConnection.prototype, "edges", void 0);
|
|
87
|
+
exports.TreeConnection = TreeConnection = __decorate([
|
|
88
|
+
(0, graphql_1.ObjectType)()
|
|
89
|
+
], TreeConnection);
|
|
90
|
+
let Tree = class Tree {
|
|
91
|
+
blobs;
|
|
92
|
+
trees;
|
|
93
|
+
};
|
|
94
|
+
exports.Tree = Tree;
|
|
95
|
+
__decorate([
|
|
96
|
+
(0, graphql_1.Field)(),
|
|
97
|
+
__metadata("design:type", BlobConnection)
|
|
98
|
+
], Tree.prototype, "blobs", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, graphql_1.Field)(),
|
|
101
|
+
__metadata("design:type", TreeConnection)
|
|
102
|
+
], Tree.prototype, "trees", void 0);
|
|
103
|
+
exports.Tree = Tree = __decorate([
|
|
104
|
+
(0, graphql_1.ObjectType)()
|
|
105
|
+
], Tree);
|
|
106
|
+
let RepositoryBlob = class RepositoryBlob {
|
|
107
|
+
name;
|
|
108
|
+
rawBlob;
|
|
109
|
+
rawTextBlob;
|
|
110
|
+
};
|
|
111
|
+
exports.RepositoryBlob = RepositoryBlob;
|
|
112
|
+
__decorate([
|
|
113
|
+
(0, graphql_1.Field)(),
|
|
114
|
+
__metadata("design:type", String)
|
|
115
|
+
], RepositoryBlob.prototype, "name", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, graphql_1.Field)(),
|
|
118
|
+
__metadata("design:type", String)
|
|
119
|
+
], RepositoryBlob.prototype, "rawBlob", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
(0, graphql_1.Field)(),
|
|
122
|
+
__metadata("design:type", String)
|
|
123
|
+
], RepositoryBlob.prototype, "rawTextBlob", void 0);
|
|
124
|
+
exports.RepositoryBlob = RepositoryBlob = __decorate([
|
|
125
|
+
(0, graphql_1.ObjectType)()
|
|
126
|
+
], RepositoryBlob);
|
|
127
|
+
let RepositoryBlobConnection = class RepositoryBlobConnection {
|
|
128
|
+
nodes;
|
|
129
|
+
};
|
|
130
|
+
exports.RepositoryBlobConnection = RepositoryBlobConnection;
|
|
131
|
+
__decorate([
|
|
132
|
+
(0, graphql_1.Field)(() => [RepositoryBlob]),
|
|
133
|
+
__metadata("design:type", Array)
|
|
134
|
+
], RepositoryBlobConnection.prototype, "nodes", void 0);
|
|
135
|
+
exports.RepositoryBlobConnection = RepositoryBlobConnection = __decorate([
|
|
136
|
+
(0, graphql_1.ObjectType)()
|
|
137
|
+
], RepositoryBlobConnection);
|
|
138
|
+
let Repository = class Repository {
|
|
139
|
+
tree;
|
|
140
|
+
blobs;
|
|
141
|
+
};
|
|
142
|
+
exports.Repository = Repository;
|
|
143
|
+
__decorate([
|
|
144
|
+
(0, graphql_1.Field)(),
|
|
145
|
+
__metadata("design:type", Tree)
|
|
146
|
+
], Repository.prototype, "tree", void 0);
|
|
147
|
+
__decorate([
|
|
148
|
+
(0, graphql_1.Field)(),
|
|
149
|
+
__metadata("design:type", RepositoryBlobConnection)
|
|
150
|
+
], Repository.prototype, "blobs", void 0);
|
|
151
|
+
exports.Repository = Repository = __decorate([
|
|
152
|
+
(0, graphql_1.ObjectType)()
|
|
153
|
+
], Repository);
|
|
154
|
+
let Project = class Project {
|
|
155
|
+
repository;
|
|
156
|
+
};
|
|
157
|
+
exports.Project = Project;
|
|
158
|
+
__decorate([
|
|
159
|
+
(0, graphql_1.Field)(() => Repository),
|
|
160
|
+
__metadata("design:type", Repository)
|
|
161
|
+
], Project.prototype, "repository", void 0);
|
|
162
|
+
exports.Project = Project = __decorate([
|
|
163
|
+
(0, graphql_1.ObjectType)()
|
|
164
|
+
], Project);
|
|
165
|
+
let Query = class Query {
|
|
166
|
+
listDirectory;
|
|
167
|
+
readFile;
|
|
168
|
+
};
|
|
169
|
+
exports.Query = Query;
|
|
170
|
+
__decorate([
|
|
171
|
+
(0, graphql_1.Field)(),
|
|
172
|
+
__metadata("design:type", Project)
|
|
173
|
+
], Query.prototype, "listDirectory", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
(0, graphql_1.Field)(),
|
|
176
|
+
__metadata("design:type", Project)
|
|
177
|
+
], Query.prototype, "readFile", void 0);
|
|
178
|
+
exports.Query = Query = __decorate([
|
|
179
|
+
(0, graphql_1.ObjectType)()
|
|
180
|
+
], Query);
|
|
181
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAoD;AAG7C,IAAM,IAAI,GAAV,MAAM,IAAI;IAEf,IAAI,CAAS;IAGb,IAAI,CAAS;CACd,CAAA;AANY,oBAAI;AAEf;IADC,IAAA,eAAK,GAAE;;kCACK;AAGb;IADC,IAAA,eAAK,GAAE;;kCACK;eALF,IAAI;IADhB,IAAA,oBAAU,GAAE;GACA,IAAI,CAMhB;AAGM,IAAM,QAAQ,GAAd,MAAM,QAAQ;IAEnB,IAAI,CAAO;CACZ,CAAA;AAHY,4BAAQ;AAEnB;IADC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,IAAI,CAAC;8BACZ,IAAI;sCAAC;mBAFA,QAAQ;IADpB,IAAA,oBAAU,GAAE;GACA,QAAQ,CAGpB;AAGM,IAAM,cAAc,GAApB,MAAM,cAAc;IAEzB,KAAK,CAAa;CACnB,CAAA;AAHY,wCAAc;AAEzB;IADC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;;6CACN;yBAFP,cAAc;IAD1B,IAA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S1B;AAEM,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAEnC,KAAK,CAAmB;CACzB,CAAA;AAHY,4DAAwB;AAEnC;IADC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC;;uDACN;mCAFb,wBAAwB;IADpC,IAAA,oBAAU,GAAE;GACA,wBAAwB,CAGpC;AAGM,IAAM,UAAU,GAAhB,MAAM,UAAU;IAErB,IAAI,CAAQ;IAGZ,KAAK,CAA4B;CAClC,CAAA;AANY,gCAAU;AAErB;IADC,IAAA,eAAK,GAAE;8BACD,IAAI;wCAAC;AAGZ;IADC,IAAA,eAAK,GAAE;8BACA,wBAAwB;yCAAC;qBALtB,UAAU;IADtB,IAAA,oBAAU,GAAE;GACA,UAAU,CAMtB;AAEM,IAAM,OAAO,GAAb,MAAM,OAAO;IAElB,UAAU,CAAa;CACxB,CAAA;AAHY,0BAAO;AAElB;IADC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,UAAU,CAAC;8BACZ,UAAU;2CAAC;kBAFZ,OAAO;IADnB,IAAA,oBAAU,GAAE;GACA,OAAO,CAGnB;AAGM,IAAM,KAAK,GAAX,MAAM,KAAK;IAEhB,aAAa,CAAU;IAGvB,QAAQ,CAAU;CACnB,CAAA;AANY,sBAAK;AAEhB;IADC,IAAA,eAAK,GAAE;8BACO,OAAO;4CAAC;AAGvB;IADC,IAAA,eAAK,GAAE;8BACE,OAAO;uCAAC;gBALP,KAAK;IADjB,IAAA,oBAAU,GAAE;GACA,KAAK,CAMjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const testing_1 = require("@nestjs/testing");
|
|
4
|
+
const request = require("supertest");
|
|
5
|
+
const app_module_1 = require("../../src/app.module");
|
|
6
|
+
const testUtil_1 = require("../testUtil");
|
|
7
|
+
describe('End to End test for the application', () => {
|
|
8
|
+
let app;
|
|
9
|
+
beforeAll(async () => {
|
|
10
|
+
const moduleFixture = await testing_1.Test.createTestingModule({
|
|
11
|
+
imports: [app_module_1.default],
|
|
12
|
+
}).compile();
|
|
13
|
+
app = moduleFixture.createNestApplication();
|
|
14
|
+
await app.init();
|
|
15
|
+
await app.listen(process.env.PORT);
|
|
16
|
+
await new Promise((resolve) => setTimeout(resolve, 4000));
|
|
17
|
+
}, 10000);
|
|
18
|
+
afterAll(async () => {
|
|
19
|
+
await app.close();
|
|
20
|
+
}, 10000);
|
|
21
|
+
it('should return the filename corresponding to the directory given in the query', async () => {
|
|
22
|
+
const query = testUtil_1.e2elistDirectory;
|
|
23
|
+
const response = await request('http://localhost:4001')
|
|
24
|
+
.post(process.env.APOLLO_PATH)
|
|
25
|
+
.send({ query });
|
|
26
|
+
expect(response.body).toEqual(testUtil_1.expectedListDirectoryResponse);
|
|
27
|
+
}, 10000);
|
|
28
|
+
it('should return the content of a file given in the query ', async () => {
|
|
29
|
+
const query = testUtil_1.e2eReadFile;
|
|
30
|
+
const response = await request('http://localhost:4001')
|
|
31
|
+
.post(process.env.APOLLO_PATH)
|
|
32
|
+
.send({ query });
|
|
33
|
+
expect(response.body).toEqual(testUtil_1.expectedFileContentResponse);
|
|
34
|
+
}, 10000);
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=app.e2e.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.e2e.spec.js","sourceRoot":"","sources":["../../../test/e2e/app.e2e.spec.ts"],"names":[],"mappings":";;AAAA,6CAAsD;AAEtD,qCAAqC;AAErC,qDAA6C;AAC7C,0CAKqB;AAErB,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;IACnD,IAAI,GAAqB,CAAC;IAE1B,SAAS,CAAC,KAAK,IAAI,EAAE;QAGnB,MAAM,aAAa,GAAkB,MAAM,cAAI,CAAC,mBAAmB,CAAC;YAClE,OAAO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AAC;AACZ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const testing_1 = require("@nestjs/testing");
|
|
4
|
+
const config_1 = require("@nestjs/config");
|
|
5
|
+
const files_resolver_1 = require("../../src/files/resolvers/files.resolver");
|
|
6
|
+
const files_service_factory_1 = require("../../src/files/services/files-service.factory");
|
|
7
|
+
const local_files_service_1 = require("../../src/files/services/local-files.service");
|
|
8
|
+
const gitlab_files_service_1 = require("../../src/files/services/gitlab-files.service");
|
|
9
|
+
const testUtil_1 = require("../testUtil");
|
|
10
|
+
describe('Integration tests for FilesResolver', () => {
|
|
11
|
+
let filesResolver;
|
|
12
|
+
let mockConfigService;
|
|
13
|
+
beforeEach(async () => {
|
|
14
|
+
mockConfigService = new testUtil_1.MockConfigService();
|
|
15
|
+
const module = await testing_1.Test.createTestingModule({
|
|
16
|
+
providers: [
|
|
17
|
+
files_resolver_1.default,
|
|
18
|
+
files_service_factory_1.default,
|
|
19
|
+
local_files_service_1.default,
|
|
20
|
+
gitlab_files_service_1.default,
|
|
21
|
+
{ provide: config_1.ConfigService, useClass: testUtil_1.MockConfigService },
|
|
22
|
+
],
|
|
23
|
+
}).compile();
|
|
24
|
+
filesResolver = module.get(files_resolver_1.default);
|
|
25
|
+
});
|
|
26
|
+
afterEach(() => {
|
|
27
|
+
jest.clearAllMocks();
|
|
28
|
+
});
|
|
29
|
+
const modes = ['local', 'gitlab'];
|
|
30
|
+
for (const mode of modes) {
|
|
31
|
+
describe(`when MODE is ${mode}`, () => {
|
|
32
|
+
beforeEach(() => {
|
|
33
|
+
jest.spyOn(mockConfigService, 'get').mockReturnValue(mode);
|
|
34
|
+
});
|
|
35
|
+
it('should be defined', () => {
|
|
36
|
+
expect(filesResolver).toBeDefined();
|
|
37
|
+
});
|
|
38
|
+
describe('listDirectory', () => {
|
|
39
|
+
it('should list files', async () => {
|
|
40
|
+
const files = await filesResolver.listDirectory(testUtil_1.pathToTestDirectory);
|
|
41
|
+
expect(files).toEqual(testUtil_1.testDirectory);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
describe('readFile', () => {
|
|
45
|
+
it('should read file', async () => {
|
|
46
|
+
const content = await filesResolver.readFile(testUtil_1.pathToTestFileContent);
|
|
47
|
+
expect(content).toEqual(testUtil_1.testFileContent);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=files.service.integration.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.service.integration.spec.js","sourceRoot":"","sources":["../../../test/integration/files.service.integration.spec.ts"],"names":[],"mappings":";;AAAA,6CAAsD;AACtD,2CAA+C;AAC/C,6EAAqE;AACrE,0FAAiF;AACjF,sFAA6E;AAC7E,wFAA+E;AAC/E,0CAMqB;AAErB,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;IACnD,IAAI,aAA4B,CAAC;IACjC,IAAI,iBAAoC,CAAC;IAEzC,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,iBAAiB,GAAG,IAAI,4BAAiB,EAAE,CAAC;QAC5C,MAAM,MAAM,GAAkB,MAAM,cAAI,CAAC,mBAAmB,CAAC;YAC3D,SAAS,EAAE;gBACT,wBAAa;gBACb,+BAAmB;gBACnB,6BAAiB;gBACjB,8BAAkB;gBAClB,EAAE,OAAO,EAAE,sBAAa,EAAE,QAAQ,EAAE,4BAAiB,EAAE;aACxD;SACF,CAAC,CAAC,OAAO,EAAE,CAAC;QAEb,aAAa,GAAG,MAAM,CAAC,GAAG,CAAgB,wBAAa,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAGlC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QAExB,QAAQ,CAAC,gBAAgB,IAAI,EAAE,EAAE,GAAG,EAAE;YACpC,UAAU,CAAC,GAAG,EAAE;gBACd,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YAC7D,CAAC,CAAC,CAAC;YAEH,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;gBAC3B,MAAM,CAAC,aAAa,CAAC,CAAC,WAAW,EAAE,CAAC;YACtC,CAAC,CAAC,CAAC;YAEH,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;gBAC7B,EAAE,CAAC,mBAAmB,EAAE,KAAK,IAAI,EAAE;oBACjC,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,aAAa,CAAC,8BAAmB,CAAC,CAAC;oBACrE,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,wBAAa,CAAC,CAAC;gBACvC,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;gBACxB,EAAE,CAAC,kBAAkB,EAAE,KAAK,IAAI,EAAE;oBAChC,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC,gCAAqB,CAAC,CAAC;oBACpE,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,0BAAe,CAAC,CAAC;gBAC3C,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;KACJ;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export declare const readFileActualContent: string[];
|
|
2
|
+
export declare const pathToTestDirectory = "user2";
|
|
3
|
+
export declare const testDirectory: {
|
|
4
|
+
repository: {
|
|
5
|
+
tree: {
|
|
6
|
+
blobs: {
|
|
7
|
+
edges: any[];
|
|
8
|
+
};
|
|
9
|
+
trees: {
|
|
10
|
+
edges: {
|
|
11
|
+
node: {
|
|
12
|
+
name: string;
|
|
13
|
+
type: string;
|
|
14
|
+
};
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare const testFileName = "README.md";
|
|
21
|
+
export declare const fstestFileContent = "content123";
|
|
22
|
+
export declare const pathToTestFileContent = "user2/tools/README.md";
|
|
23
|
+
export declare const testFileArray: string[];
|
|
24
|
+
export declare const testFileContent: {
|
|
25
|
+
repository: {
|
|
26
|
+
blobs: {
|
|
27
|
+
nodes: {
|
|
28
|
+
name: string;
|
|
29
|
+
rawBlob: string;
|
|
30
|
+
rawTextBlob: string;
|
|
31
|
+
}[];
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export declare function sleep(ms: any): void;
|
|
36
|
+
export declare class MockConfigService {
|
|
37
|
+
get(key: string): string;
|
|
38
|
+
}
|
|
39
|
+
export declare const mockReadFileResponseData: {
|
|
40
|
+
project: {
|
|
41
|
+
__typename: string;
|
|
42
|
+
repository: {
|
|
43
|
+
__typename: string;
|
|
44
|
+
blobs: {
|
|
45
|
+
nodes: {
|
|
46
|
+
__typename: string;
|
|
47
|
+
name: string;
|
|
48
|
+
rawBlob: string;
|
|
49
|
+
rawTextBlob: string;
|
|
50
|
+
}[];
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export declare const expectedListDirectoryResponse: {
|
|
56
|
+
data: {
|
|
57
|
+
listDirectory: {
|
|
58
|
+
repository: {
|
|
59
|
+
tree: {
|
|
60
|
+
trees: {
|
|
61
|
+
edges: {
|
|
62
|
+
node: {
|
|
63
|
+
name: string;
|
|
64
|
+
};
|
|
65
|
+
}[];
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
export declare const expectedFileContentResponse: {
|
|
73
|
+
data: {
|
|
74
|
+
readFile: {
|
|
75
|
+
repository: {
|
|
76
|
+
blobs: {
|
|
77
|
+
nodes: {
|
|
78
|
+
name: string;
|
|
79
|
+
rawBlob: string;
|
|
80
|
+
rawTextBlob: string;
|
|
81
|
+
}[];
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
export declare const e2elistDirectory = "query {\n listDirectory(path:\"user2\")\n {\n repository{\n tree{\n trees{\n edges{\n node{\n name\n \n }\n }\n }\n }\n }\n }\n}";
|
|
88
|
+
export declare const e2eReadFile = "query {\n readFile(path:\"user2/tools/README.md\") {\n repository {\n blobs {\n nodes {\n name\n rawBlob\n rawTextBlob\n }\n }\n }\n }\n}";
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.e2eReadFile = exports.e2elistDirectory = exports.expectedFileContentResponse = exports.expectedListDirectoryResponse = exports.mockReadFileResponseData = exports.MockConfigService = exports.sleep = exports.testFileContent = exports.testFileArray = exports.pathToTestFileContent = exports.fstestFileContent = exports.testFileName = exports.testDirectory = exports.pathToTestDirectory = exports.readFileActualContent = void 0;
|
|
4
|
+
const dotenv = require("dotenv");
|
|
5
|
+
const promises_1 = require("timers/promises");
|
|
6
|
+
dotenv.config({ path: '.env' });
|
|
7
|
+
exports.readFileActualContent = ['content123'];
|
|
8
|
+
exports.pathToTestDirectory = 'user2';
|
|
9
|
+
exports.testDirectory = {
|
|
10
|
+
repository: {
|
|
11
|
+
tree: {
|
|
12
|
+
blobs: { edges: [] },
|
|
13
|
+
trees: {
|
|
14
|
+
edges: [
|
|
15
|
+
{ node: { name: 'data', type: 'tree' } },
|
|
16
|
+
{ node: { name: 'digital_twins', type: 'tree' } },
|
|
17
|
+
{ node: { name: 'functions', type: 'tree' } },
|
|
18
|
+
{ node: { name: 'models', type: 'tree' } },
|
|
19
|
+
{ node: { name: 'tools', type: 'tree' } },
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
exports.testFileName = 'README.md';
|
|
26
|
+
exports.fstestFileContent = 'content123';
|
|
27
|
+
exports.pathToTestFileContent = 'user2/tools/README.md';
|
|
28
|
+
exports.testFileArray = [
|
|
29
|
+
'data',
|
|
30
|
+
'digital_twins',
|
|
31
|
+
'functions',
|
|
32
|
+
'models',
|
|
33
|
+
'tools',
|
|
34
|
+
];
|
|
35
|
+
exports.testFileContent = {
|
|
36
|
+
repository: {
|
|
37
|
+
blobs: {
|
|
38
|
+
nodes: [
|
|
39
|
+
{
|
|
40
|
+
name: 'README.md',
|
|
41
|
+
rawBlob: 'content123',
|
|
42
|
+
rawTextBlob: 'content123',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
function sleep(ms) {
|
|
49
|
+
const timer = (0, promises_1.setTimeout)(ms);
|
|
50
|
+
Promise.resolve(timer);
|
|
51
|
+
}
|
|
52
|
+
exports.sleep = sleep;
|
|
53
|
+
class MockConfigService {
|
|
54
|
+
get(key) {
|
|
55
|
+
switch (key) {
|
|
56
|
+
case 'TOKEN':
|
|
57
|
+
return process.env.TOKEN;
|
|
58
|
+
case 'LOCAL_PATH':
|
|
59
|
+
return process.env.TEST_PATH;
|
|
60
|
+
case 'GITLAB_URL':
|
|
61
|
+
return process.env.GITLAB_URL;
|
|
62
|
+
case 'GITLAB_GROUP':
|
|
63
|
+
return 'dtaas';
|
|
64
|
+
case 'MODE':
|
|
65
|
+
if (process.env.MODE === 'gitlab') {
|
|
66
|
+
return 'gitlab';
|
|
67
|
+
}
|
|
68
|
+
if (process.env.MODE === 'local') {
|
|
69
|
+
return 'local';
|
|
70
|
+
}
|
|
71
|
+
return 'unknown';
|
|
72
|
+
default:
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.MockConfigService = MockConfigService;
|
|
78
|
+
exports.mockReadFileResponseData = {
|
|
79
|
+
project: {
|
|
80
|
+
__typename: 'Project',
|
|
81
|
+
repository: {
|
|
82
|
+
__typename: 'Repository',
|
|
83
|
+
blobs: {
|
|
84
|
+
nodes: [
|
|
85
|
+
{
|
|
86
|
+
__typename: 'Blob',
|
|
87
|
+
name: 'README.md',
|
|
88
|
+
rawBlob: 'content123',
|
|
89
|
+
rawTextBlob: 'content123',
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
exports.expectedListDirectoryResponse = {
|
|
97
|
+
data: {
|
|
98
|
+
listDirectory: {
|
|
99
|
+
repository: {
|
|
100
|
+
tree: {
|
|
101
|
+
trees: {
|
|
102
|
+
edges: [
|
|
103
|
+
{
|
|
104
|
+
node: {
|
|
105
|
+
name: 'data',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
node: {
|
|
110
|
+
name: 'digital_twins',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
node: {
|
|
115
|
+
name: 'functions',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
node: {
|
|
120
|
+
name: 'models',
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
node: {
|
|
125
|
+
name: 'tools',
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
exports.expectedFileContentResponse = {
|
|
136
|
+
data: {
|
|
137
|
+
readFile: {
|
|
138
|
+
repository: {
|
|
139
|
+
blobs: {
|
|
140
|
+
nodes: [
|
|
141
|
+
{
|
|
142
|
+
name: 'README.md',
|
|
143
|
+
rawBlob: 'content123',
|
|
144
|
+
rawTextBlob: 'content123',
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
exports.e2elistDirectory = `query {
|
|
153
|
+
listDirectory(path:"user2")
|
|
154
|
+
{
|
|
155
|
+
repository{
|
|
156
|
+
tree{
|
|
157
|
+
trees{
|
|
158
|
+
edges{
|
|
159
|
+
node{
|
|
160
|
+
name
|
|
161
|
+
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}`;
|
|
169
|
+
exports.e2eReadFile = `query {
|
|
170
|
+
readFile(path:"user2/tools/README.md") {
|
|
171
|
+
repository {
|
|
172
|
+
blobs {
|
|
173
|
+
nodes {
|
|
174
|
+
name
|
|
175
|
+
rawBlob
|
|
176
|
+
rawTextBlob
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}`;
|
|
182
|
+
//# sourceMappingURL=testUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testUtil.js","sourceRoot":"","sources":["../../test/testUtil.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,8CAA6C;AAE7C,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AAGnB,QAAA,qBAAqB,GAAG,CAAC,YAAY,CAAC,CAAC;AAEvC,QAAA,mBAAmB,GAAG,OAAO,CAAC;AAE9B,QAAA,aAAa,GAAG;IAC3B,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;YACpB,KAAK,E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AG;IACzC,IAAI,EAAE;QACJ,QAAQ,EAAE;YACR,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,KAAK,EAAE;wBACL;4BACE,IAAI,EAAE,WAAW;4BACjB,OAAO,EAAE,YAAY;4BACrB,WAAW,EAAE,YAAY;yBAC1B;qBACF;iBACF;aACF;SACF;KACF;CACF,CAAC;AAEW,QAAA,gBAAgB,GAAG;;;;;;;;;;;;;;;;EAgB9B,CAAC;AAEU,QAAA,WAAW,GAAG;;;;;;;;;;;;EAYzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const testing_1 = require("@nestjs/testing");
|
|
4
|
+
const config_1 = require("@nestjs/config");
|
|
5
|
+
const files_service_factory_1 = require("../../src/files/services/files-service.factory");
|
|
6
|
+
const local_files_service_1 = require("../../src/files/services/local-files.service");
|
|
7
|
+
const gitlab_files_service_1 = require("../../src/files/services/gitlab-files.service");
|
|
8
|
+
describe('FilesServiceFactory', () => {
|
|
9
|
+
let serviceFactory;
|
|
10
|
+
let configService;
|
|
11
|
+
let localFilesService;
|
|
12
|
+
let gitlabFilesService;
|
|
13
|
+
beforeEach(async () => {
|
|
14
|
+
localFilesService = new local_files_service_1.default(configService);
|
|
15
|
+
gitlabFilesService = new gitlab_files_service_1.default(configService);
|
|
16
|
+
const module = await testing_1.Test.createTestingModule({
|
|
17
|
+
providers: [
|
|
18
|
+
files_service_factory_1.default,
|
|
19
|
+
{ provide: config_1.ConfigService, useValue: { get: jest.fn() } },
|
|
20
|
+
{ provide: local_files_service_1.default, useValue: localFilesService },
|
|
21
|
+
{ provide: gitlab_files_service_1.default, useValue: gitlabFilesService },
|
|
22
|
+
],
|
|
23
|
+
}).compile();
|
|
24
|
+
serviceFactory = module.get(files_service_factory_1.default);
|
|
25
|
+
configService = module.get(config_1.ConfigService);
|
|
26
|
+
});
|
|
27
|
+
it('should create a local files service when MODE is local', () => {
|
|
28
|
+
jest.spyOn(configService, 'get').mockReturnValue('local');
|
|
29
|
+
expect(serviceFactory.create()).toBe(localFilesService);
|
|
30
|
+
});
|
|
31
|
+
it('should create a gitlab files service when MODE is gitlab', () => {
|
|
32
|
+
jest.spyOn(configService, 'get').mockReturnValue('gitlab');
|
|
33
|
+
expect(serviceFactory.create()).toBe(gitlabFilesService);
|
|
34
|
+
});
|
|
35
|
+
it('should throw an error when MODE is invalid', () => {
|
|
36
|
+
jest.spyOn(configService, 'get').mockReturnValue('invalid');
|
|
37
|
+
expect(() => serviceFactory.create()).toThrowError(`Invalid MODE: invalid`);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=files-service.factory.unit.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files-service.factory.unit.spec.js","sourceRoot":"","sources":["../../../test/unit/files-service.factory.unit.spec.ts"],"names":[],"mappings":";;AACA,6CAAsD;AACtD,2CAA+C;AAC/C,0FAAiF;AACjF,sFAA6E;AAC7E,wFAA+E;AAG/E,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAI,cAAmC,CAAC;IACxC,IAAI,aAA4B,CAAC;IACjC,IAAI,iBAAgC,CAAC;IACrC,IAAI,kBAAiC,CAAC;IAEtC,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,iBAAiB,GAAG,IAAI,6BAAiB,CAAC,aAA8B,CAAC,CAAC;QAC1E,kBAAkB,GAAG,IAAI,8BAAkB,CAAC,aAA8B,CAAC,CAAC;QAE5E,MAAM,MAAM,GAAkB,MAAM,cAAI,CAAC,mBAAmB,CAAC;YAC3D,SAAS,EAAE;gBACT,+BAAmB;gBACnB,EAAE,OAAO,EAAE,sBAAa,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE;gBACxD,EAAE,OAAO,E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