@into-cps-association/libms 0.4.0 → 0.4.3
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/config/.env.default +3 -3
- package/package.json +14 -14
- package/.env +0 -6
- package/dist/src/app.module.d.ts +0 -2
- package/dist/src/app.module.js +0 -36
- package/dist/src/app.module.js.map +0 -1
- package/dist/src/bootstrap.d.ts +0 -7
- package/dist/src/bootstrap.js +0 -31
- package/dist/src/bootstrap.js.map +0 -1
- package/dist/src/cloudcmd/cloudcmd.d.ts +0 -3
- package/dist/src/cloudcmd/cloudcmd.js +0 -22
- package/dist/src/cloudcmd/cloudcmd.js.map +0 -1
- package/dist/src/files/files.module.d.ts +0 -2
- package/dist/src/files/files.module.js +0 -21
- package/dist/src/files/files.module.js.map +0 -1
- package/dist/src/files/interfaces/files.service.interface.d.ts +0 -5
- package/dist/src/files/interfaces/files.service.interface.js +0 -3
- package/dist/src/files/interfaces/files.service.interface.js.map +0 -1
- package/dist/src/files/resolvers/files.resolver.d.ts +0 -8
- package/dist/src/files/resolvers/files.resolver.js +0 -49
- package/dist/src/files/resolvers/files.resolver.js.map +0 -1
- package/dist/src/files/services/files-service.factory.d.ts +0 -9
- package/dist/src/files/services/files-service.factory.js +0 -40
- package/dist/src/files/services/files-service.factory.js.map +0 -1
- package/dist/src/files/services/local-files.service.d.ts +0 -11
- package/dist/src/files/services/local-files.service.js +0 -77
- package/dist/src/files/services/local-files.service.js.map +0 -1
- package/dist/src/main.d.ts +0 -2
- package/dist/src/main.js +0 -20
- package/dist/src/main.js.map +0 -1
- package/dist/src/types.d.ts +0 -43
- package/dist/src/types.js +0 -181
- package/dist/src/types.js.map +0 -1
- package/dist/test/cloudcmd/cloudcmd.spec.d.ts +0 -1
- package/dist/test/cloudcmd/cloudcmd.spec.js +0 -35
- package/dist/test/cloudcmd/cloudcmd.spec.js.map +0 -1
- package/dist/test/e2e/app.e2e.spec.d.ts +0 -1
- package/dist/test/e2e/app.e2e.spec.js +0 -53
- package/dist/test/e2e/app.e2e.spec.js.map +0 -1
- package/dist/test/integration/files.service.integration.spec.d.ts +0 -1
- package/dist/test/integration/files.service.integration.spec.js +0 -51
- package/dist/test/integration/files.service.integration.spec.js.map +0 -1
- package/dist/test/testUtil.d.ts +0 -88
- package/dist/test/testUtil.js +0 -173
- package/dist/test/testUtil.js.map +0 -1
- package/dist/test/unit/files-service.factory.unit.spec.d.ts +0 -1
- package/dist/test/unit/files-service.factory.unit.spec.js +0 -32
- package/dist/test/unit/files-service.factory.unit.spec.js.map +0 -1
- package/dist/test/unit/files.resolver.unit.spec.d.ts +0 -1
- package/dist/test/unit/files.resolver.unit.spec.js +0 -56
- package/dist/test/unit/files.resolver.unit.spec.js.map +0 -1
- package/dist/test/unit/local-files.service.unit.spec.d.ts +0 -1
- package/dist/test/unit/local-files.service.unit.spec.js +0 -84
- package/dist/test/unit/local-files.service.unit.spec.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/test/coverage/clover.xml +0 -35
- package/test/coverage/coverage-final.json +0 -2
- package/test/coverage/lcov-report/base.css +0 -362
- package/test/coverage/lcov-report/block-navigation.js +0 -87
- package/test/coverage/lcov-report/favicon.png +0 -0
- package/test/coverage/lcov-report/index.html +0 -116
- package/test/coverage/lcov-report/prettify.css +0 -101
- package/test/coverage/lcov-report/prettify.js +0 -2
- package/test/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/test/coverage/lcov-report/sorter.js +0 -196
- package/test/coverage/lcov-report/testUtil.ts.html +0 -628
- package/test/coverage/lcov.info +0 -43
package/dist/src/types.js
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
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
|
package/dist/src/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,IAAA,oBAAU,GAAE;GACA,cAAc,CAG1B;AAGM,IAAM,SAAS,GAAf,MAAM,SAAS;IAEpB,IAAI,CAAS;IAGb,IAAI,CAAS;CACd,CAAA;AANY,8BAAS;AAEpB;IADC,IAAA,eAAK,GAAE;;uCACK;AAGb;IADC,IAAA,eAAK,GAAE;;uCACK;oBALF,SAAS;IADrB,IAAA,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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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const axios_1 = require("axios");
|
|
4
|
-
const promises_1 = require("fs/promises");
|
|
5
|
-
const dotenv_1 = require("dotenv");
|
|
6
|
-
describe('cloudcmd test for the application', () => {
|
|
7
|
-
beforeAll(async () => {
|
|
8
|
-
(0, dotenv_1.config)();
|
|
9
|
-
await (0, promises_1.writeFile)(`${process.env.LOCAL_PATH}/test.txt`, 'content12345');
|
|
10
|
-
await new Promise((resolve) => setTimeout(resolve, 8000));
|
|
11
|
-
}, 10000);
|
|
12
|
-
afterAll(async () => {
|
|
13
|
-
await (0, promises_1.unlink)(`${process.env.LOCAL_PATH}/test.txt`);
|
|
14
|
-
await (0, promises_1.unlink)(`${process.env.LOCAL_PATH}/uploadTest.txt`);
|
|
15
|
-
}, 10000);
|
|
16
|
-
it('should return the correct directory that is set as root', async () => {
|
|
17
|
-
const response = await axios_1.default.get(`http://localhost:${process.env.PORT}${process.env.APOLLO_PATH}/files/api/v1/fs`, {
|
|
18
|
-
responseType: 'json',
|
|
19
|
-
});
|
|
20
|
-
console.log(response.data);
|
|
21
|
-
expect(response.data.path).toEqual('/');
|
|
22
|
-
expect(response.data.files[0].name).toEqual('common');
|
|
23
|
-
expect(response.data.files[1].name).toEqual('user1');
|
|
24
|
-
expect(response.data.files[2].name).toEqual('user2');
|
|
25
|
-
}, 10000);
|
|
26
|
-
it('should return the content of a file that is uplaoded to cloudcmd ', async () => {
|
|
27
|
-
const response = await axios_1.default.get(`http://localhost:${process.env.PORT}${process.env.APOLLO_PATH}/files/api/v1/fs/test.txt`);
|
|
28
|
-
expect(response.data).toEqual('content12345');
|
|
29
|
-
}, 10000);
|
|
30
|
-
it('should upload a file to cloudcmd', async () => {
|
|
31
|
-
const response = await axios_1.default.put(`http://localhost:${process.env.PORT}${process.env.APOLLO_PATH}/files/api/v1/fs/uploadTest.txt`, 'some content', { responseType: 'text' });
|
|
32
|
-
expect(response.data).toEqual('save: ok("uploadTest.txt")');
|
|
33
|
-
}, 10000);
|
|
34
|
-
});
|
|
35
|
-
//# sourceMappingURL=cloudcmd.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cloudcmd.spec.js","sourceRoot":"","sources":["../../../test/cloudcmd/cloudcmd.spec.ts"],"names":[],"mappings":";;AAAA,iCAA0B;AAC1B,0CAAgD;AAChD,mCAAgC;AAEhC,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;IACjD,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,IAAA,eAAM,GAAE,CAAC;QAET,MAAM,IAAA,oBAAS,EAAC,GAAG,OAAO,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C,CAAC;IAEV,EAAE,CAAC,mEAAmE,EAAE,KAAK,IAAI,EAAE;QACjF,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAC9B,oBAAoB,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,2BAA2B,CAC1F,CAAC;QAEF,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC,EAAE,KAAK,CAAC,CAAC;IAEV,EAAE,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;QAChD,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAC9B,oBAAoB,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,iCAAiC,EAC/F,cAAc,EACd,EAAE,YAAY,EAAE,MAAM,EAAE,CACzB,CAAC;QAEF,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAC9D,CAAC,EAAE,KAAK,CAAC,CAAC;AACZ,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const testing_1 = require("@nestjs/testing");
|
|
4
|
-
const request = require("supertest");
|
|
5
|
-
const cross_fetch_1 = require("cross-fetch");
|
|
6
|
-
const client_1 = require("@apollo/client");
|
|
7
|
-
const app_module_1 = require("../../src/app.module");
|
|
8
|
-
const testUtil_1 = require("../testUtil");
|
|
9
|
-
const client = new client_1.ApolloClient({
|
|
10
|
-
link: new client_1.HttpLink({
|
|
11
|
-
uri: `http://localhost:${process.env.PORT}${process.env.APOLLO_PATH}`,
|
|
12
|
-
fetch: cross_fetch_1.default,
|
|
13
|
-
}),
|
|
14
|
-
cache: new client_1.InMemoryCache({ addTypename: false }),
|
|
15
|
-
});
|
|
16
|
-
describe('End to End test for the application', () => {
|
|
17
|
-
let app;
|
|
18
|
-
beforeAll(async () => {
|
|
19
|
-
const moduleFixture = await testing_1.Test.createTestingModule({
|
|
20
|
-
imports: [app_module_1.default],
|
|
21
|
-
}).compile();
|
|
22
|
-
app = moduleFixture.createNestApplication();
|
|
23
|
-
await app.init();
|
|
24
|
-
await app.listen(process.env.PORT);
|
|
25
|
-
await new Promise((resolve) => setTimeout(resolve, 4000));
|
|
26
|
-
}, 10000);
|
|
27
|
-
afterAll(async () => {
|
|
28
|
-
await app.close();
|
|
29
|
-
}, 10000);
|
|
30
|
-
async function HTTPQuery(query, expectedResponse) {
|
|
31
|
-
const response = await request(`http://localhost:${process.env.PORT}`)
|
|
32
|
-
.post(process.env.APOLLO_PATH)
|
|
33
|
-
.send({ query });
|
|
34
|
-
expect(response.body).toEqual(expectedResponse);
|
|
35
|
-
}
|
|
36
|
-
async function GraphQLQuery(query, expectedResponse) {
|
|
37
|
-
const { data } = await client.query({ query });
|
|
38
|
-
expect({ data }).toEqual(expectedResponse);
|
|
39
|
-
}
|
|
40
|
-
it('should return the directory contents requested with HTTP POST query', async () => {
|
|
41
|
-
await HTTPQuery(testUtil_1.e2elistDirectory, testUtil_1.expectedListDirectoryResponse);
|
|
42
|
-
}, 10000);
|
|
43
|
-
it('should return the file content requested with HTTP POST query', async () => {
|
|
44
|
-
await HTTPQuery(testUtil_1.e2eReadFile, testUtil_1.expectedFileContentResponse);
|
|
45
|
-
}, 10000);
|
|
46
|
-
it('should return the directory contents requested with GraphQL query', async () => {
|
|
47
|
-
await GraphQLQuery((0, client_1.gql)(testUtil_1.e2elistDirectory), testUtil_1.expectedListDirectoryResponse);
|
|
48
|
-
}, 10000);
|
|
49
|
-
it('should return the file content requested with GraphQL query', async () => {
|
|
50
|
-
await GraphQLQuery((0, client_1.gql)(testUtil_1.e2eReadFile), testUtil_1.expectedFileContentResponse);
|
|
51
|
-
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AC;AACZ,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,51 +0,0 @@
|
|
|
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 testUtil_1 = require("../testUtil");
|
|
9
|
-
describe('Integration tests for FilesResolver', () => {
|
|
10
|
-
let filesResolver;
|
|
11
|
-
let mockConfigService;
|
|
12
|
-
beforeEach(async () => {
|
|
13
|
-
mockConfigService = new testUtil_1.MockConfigService();
|
|
14
|
-
const module = await testing_1.Test.createTestingModule({
|
|
15
|
-
providers: [
|
|
16
|
-
files_resolver_1.default,
|
|
17
|
-
files_service_factory_1.default,
|
|
18
|
-
local_files_service_1.default,
|
|
19
|
-
{ provide: config_1.ConfigService, useClass: testUtil_1.MockConfigService },
|
|
20
|
-
],
|
|
21
|
-
}).compile();
|
|
22
|
-
filesResolver = module.get(files_resolver_1.default);
|
|
23
|
-
});
|
|
24
|
-
afterEach(() => {
|
|
25
|
-
jest.clearAllMocks();
|
|
26
|
-
});
|
|
27
|
-
const modes = ['local'];
|
|
28
|
-
for (const mode of modes) {
|
|
29
|
-
describe(`when MODE is ${mode}`, () => {
|
|
30
|
-
beforeEach(() => {
|
|
31
|
-
jest.spyOn(mockConfigService, 'get').mockReturnValue(mode);
|
|
32
|
-
});
|
|
33
|
-
it('should be defined', () => {
|
|
34
|
-
expect(filesResolver).toBeDefined();
|
|
35
|
-
});
|
|
36
|
-
describe('listDirectory', () => {
|
|
37
|
-
it('should list files', async () => {
|
|
38
|
-
const files = await filesResolver.listDirectory(testUtil_1.pathToTestDirectory);
|
|
39
|
-
expect(files).toEqual(testUtil_1.testDirectory);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
describe('readFile', () => {
|
|
43
|
-
it('should read file', async () => {
|
|
44
|
-
const content = await filesResolver.readFile(testUtil_1.pathToTestFileContent);
|
|
45
|
-
expect(content).toEqual(testUtil_1.testFileContent);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
//# sourceMappingURL=files.service.integration.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,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,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,CAAC,CAAC;IAGxB,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"}
|
package/dist/test/testUtil.d.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
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}";
|
package/dist/test/testUtil.js
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
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 'LOCAL_PATH':
|
|
57
|
-
return process.env.LOCAL_PATH;
|
|
58
|
-
case 'MODE':
|
|
59
|
-
if (process.env.MODE === 'local') {
|
|
60
|
-
return 'local';
|
|
61
|
-
}
|
|
62
|
-
return 'unknown';
|
|
63
|
-
default:
|
|
64
|
-
return undefined;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.MockConfigService = MockConfigService;
|
|
69
|
-
exports.mockReadFileResponseData = {
|
|
70
|
-
project: {
|
|
71
|
-
__typename: 'Project',
|
|
72
|
-
repository: {
|
|
73
|
-
__typename: 'Repository',
|
|
74
|
-
blobs: {
|
|
75
|
-
nodes: [
|
|
76
|
-
{
|
|
77
|
-
__typename: 'Blob',
|
|
78
|
-
name: 'README.md',
|
|
79
|
-
rawBlob: 'content123',
|
|
80
|
-
rawTextBlob: 'content123',
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
exports.expectedListDirectoryResponse = {
|
|
88
|
-
data: {
|
|
89
|
-
listDirectory: {
|
|
90
|
-
repository: {
|
|
91
|
-
tree: {
|
|
92
|
-
trees: {
|
|
93
|
-
edges: [
|
|
94
|
-
{
|
|
95
|
-
node: {
|
|
96
|
-
name: 'data',
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
node: {
|
|
101
|
-
name: 'digital_twins',
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
node: {
|
|
106
|
-
name: 'functions',
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
node: {
|
|
111
|
-
name: 'models',
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
node: {
|
|
116
|
-
name: 'tools',
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
exports.expectedFileContentResponse = {
|
|
127
|
-
data: {
|
|
128
|
-
readFile: {
|
|
129
|
-
repository: {
|
|
130
|
-
blobs: {
|
|
131
|
-
nodes: [
|
|
132
|
-
{
|
|
133
|
-
name: 'README.md',
|
|
134
|
-
rawBlob: 'content123',
|
|
135
|
-
rawTextBlob: 'content123',
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
};
|
|
143
|
-
exports.e2elistDirectory = `query {
|
|
144
|
-
listDirectory(path:"user2")
|
|
145
|
-
{
|
|
146
|
-
repository{
|
|
147
|
-
tree{
|
|
148
|
-
trees{
|
|
149
|
-
edges{
|
|
150
|
-
node{
|
|
151
|
-
name
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}`;
|
|
160
|
-
exports.e2eReadFile = `query {
|
|
161
|
-
readFile(path:"user2/tools/README.md") {
|
|
162
|
-
repository {
|
|
163
|
-
blobs {
|
|
164
|
-
nodes {
|
|
165
|
-
name
|
|
166
|
-
rawBlob
|
|
167
|
-
rawTextBlob
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}`;
|
|
173
|
-
//# sourceMappingURL=testUtil.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAE;gBACL,KAAK,EAAE;oBACL,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;oBACxC,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;oBACjD,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;oBAC7C,EAAE,IAAI,EAAE,EAAE,IAAI,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U,EAAE,MAAM;wBAClB,IAAI,EAAE,WAAW;wBACjB,OAAO,EAAE,YAAY;wBACrB,WAAW,EAAE,YAAY;qBAC1B;iBACF;aACF;SACF;KACF;CACF,CAAC;AAEW,QAAA,6BAA6B,GAAG;IAC3C,IAAI,EAAE;QACJ,aAAa,EAAE;YACb,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,KAAK,EAAE;wBACL,KAAK,EAAE;4BACL;gCACE,IAAI,EAAE;oCACJ,IAAI,EAAE,MAAM;iCACb;6BACF;4BACD;gCACE,IAAI,EAAE;oCACJ,IAAI,EAAE,eAAe;iCACtB;6BACF;4BACD;gCACE,IAAI,EAAE;oCACJ,IAAI,EAAE,WAAW;iCAClB;6BACF;4BACD;gCACE,IAAI,EAAE;oCACJ,IAAI,EAAE,QAAQ;iCACf;6BACF;4BACD;gCACE,IAAI,EAAE;oCACJ,IAAI,EAAE,OAAO;iCACd;6BACF;yBACF;qBACF;iBACF;aACF;SACF;KACF;CACF,CAAC;AAEW,QAAA,2BAA2B,GAAG;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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
describe('FilesServiceFactory', () => {
|
|
8
|
-
let serviceFactory;
|
|
9
|
-
let configService;
|
|
10
|
-
let localFilesService;
|
|
11
|
-
beforeEach(async () => {
|
|
12
|
-
localFilesService = new local_files_service_1.default(configService);
|
|
13
|
-
const module = await testing_1.Test.createTestingModule({
|
|
14
|
-
providers: [
|
|
15
|
-
files_service_factory_1.default,
|
|
16
|
-
{ provide: config_1.ConfigService, useValue: { get: jest.fn() } },
|
|
17
|
-
{ provide: local_files_service_1.default, useValue: localFilesService },
|
|
18
|
-
],
|
|
19
|
-
}).compile();
|
|
20
|
-
serviceFactory = module.get(files_service_factory_1.default);
|
|
21
|
-
configService = module.get(config_1.ConfigService);
|
|
22
|
-
});
|
|
23
|
-
it('should create a local files service when MODE is local', () => {
|
|
24
|
-
jest.spyOn(configService, 'get').mockReturnValue('local');
|
|
25
|
-
expect(serviceFactory.create()).toBe(localFilesService);
|
|
26
|
-
});
|
|
27
|
-
it('should throw an error when MODE is invalid', () => {
|
|
28
|
-
jest.spyOn(configService, 'get').mockReturnValue('invalid');
|
|
29
|
-
expect(() => serviceFactory.create()).toThrowError(`Invalid MODE: invalid`);
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
//# sourceMappingURL=files-service.factory.unit.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AAG7E,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAI,cAAmC,CAAC;IACxC,IAAI,aAA4B,CAAC;IACjC,IAAI,iBAAgC,CAAC;IAErC,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,iBAAiB,GAAG,IAAI,6BAAiB,CAAC,aAA8B,CAAC,CAAC;Q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