declastruct-github 1.0.3 → 1.0.5
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/dist/access/daos/DeclaredGithubBranchDao.d.ts +1 -1
- package/dist/access/daos/DeclaredGithubBranchProtectionDao.d.ts +1 -1
- package/dist/access/daos/DeclaredGithubRepoConfigDao.d.ts +1 -1
- package/dist/access/daos/DeclaredGithubRepoDao.d.ts +1 -1
- package/dist/access/sdks/getGithubClient.d.ts +3 -4
- package/dist/access/sdks/getGithubClient.js.map +1 -1
- package/dist/contract/sdks/index.d.ts +4 -4
- package/dist/contract/sdks/index.js +8 -8
- package/dist/contract/sdks/index.js.map +1 -1
- package/dist/domain/constants.d.ts +3 -0
- package/dist/domain/constants.js +5 -0
- package/dist/domain/constants.js.map +1 -0
- package/dist/domain.objects/DeclaredGithubBranch.d.ts +1 -1
- package/dist/domain.objects/DeclaredGithubBranchProtection.d.ts +1 -1
- package/dist/domain.objects/DeclaredGithubRepo.d.ts +1 -1
- package/dist/domain.objects/DeclaredGithubRepoConfig.d.ts +1 -1
- package/dist/domain.objects/DeclastructGithubProvider.d.ts +6 -6
- package/dist/domain.operations/branch/castToDeclaredGithubBranch.d.ts +3 -3
- package/dist/domain.operations/branch/castToDeclaredGithubBranch.js.map +1 -1
- package/dist/domain.operations/branch/getBranch.d.ts +5 -5
- package/dist/domain.operations/branch/getBranchCommitShaByRepoDefault.d.ts +4 -4
- package/dist/domain.operations/branch/getBranches.d.ts +6 -6
- package/dist/domain.operations/branch/setBranch.d.ts +4 -4
- package/dist/domain.operations/branchProtection/castToDeclaredGithubBranchProtection.d.ts +3 -3
- package/dist/domain.operations/branchProtection/castToDeclaredGithubBranchProtection.js.map +1 -1
- package/dist/domain.operations/branchProtection/getBranchProtection.d.ts +5 -5
- package/dist/domain.operations/branchProtection/setBranchProtection.d.ts +4 -4
- package/dist/domain.operations/provider/getDeclastructGithubProvider.d.ts +1 -1
- package/dist/domain.operations/repo/castToDeclaredGithubRepo.d.ts +2 -2
- package/dist/domain.operations/repo/castToDeclaredGithubRepo.js.map +1 -1
- package/dist/domain.operations/repo/getRepo.d.ts +5 -5
- package/dist/domain.operations/repo/getRepos.d.ts +4 -4
- package/dist/domain.operations/repo/setRepo.d.ts +4 -4
- package/dist/domain.operations/repoConfig/castToDeclaredGithubRepoConfig.d.ts +3 -3
- package/dist/domain.operations/repoConfig/castToDeclaredGithubRepoConfig.js.map +1 -1
- package/dist/domain.operations/repoConfig/getRepoConfig.d.ts +5 -5
- package/dist/domain.operations/repoConfig/setRepoConfig.d.ts +4 -4
- package/license.md +21 -0
- package/package.json +34 -39
- package/dist/.test/assets/getSampleGithubContext.d.ts +0 -6
- package/dist/.test/assets/getSampleGithubContext.js +0 -18
- package/dist/.test/assets/getSampleGithubContext.js.map +0 -1
- package/dist/.test/assets/getSampleRepo.d.ts +0 -9
- package/dist/.test/assets/getSampleRepo.js +0 -16
- package/dist/.test/assets/getSampleRepo.js.map +0 -1
- package/dist/contract/sdks/declastruct.acceptance.test.d.ts +0 -1
- package/dist/contract/sdks/declastruct.acceptance.test.js +0 -104
- package/dist/contract/sdks/declastruct.acceptance.test.js.map +0 -1
- package/dist/domain.operations/branch/getBranch.integration.test.d.ts +0 -1
- package/dist/domain.operations/branch/getBranch.integration.test.js +0 -59
- package/dist/domain.operations/branch/getBranch.integration.test.js.map +0 -1
- package/dist/domain.operations/branch/getBranches.integration.test.d.ts +0 -1
- package/dist/domain.operations/branch/getBranches.integration.test.js +0 -40
- package/dist/domain.operations/branch/getBranches.integration.test.js.map +0 -1
- package/dist/domain.operations/branch/setBranch.integration.test.d.ts +0 -1
- package/dist/domain.operations/branch/setBranch.integration.test.js +0 -65
- package/dist/domain.operations/branch/setBranch.integration.test.js.map +0 -1
- package/dist/domain.operations/branch/setBranch.test.d.ts +0 -1
- package/dist/domain.operations/branch/setBranch.test.js +0 -151
- package/dist/domain.operations/branch/setBranch.test.js.map +0 -1
- package/dist/domain.operations/branchProtection/getBranchProtection.integration.test.d.ts +0 -1
- package/dist/domain.operations/branchProtection/getBranchProtection.integration.test.js +0 -63
- package/dist/domain.operations/branchProtection/getBranchProtection.integration.test.js.map +0 -1
- package/dist/domain.operations/branchProtection/setBranchProtection.integration.test.d.ts +0 -1
- package/dist/domain.operations/branchProtection/setBranchProtection.integration.test.js +0 -96
- package/dist/domain.operations/branchProtection/setBranchProtection.integration.test.js.map +0 -1
- package/dist/domain.operations/branchProtection/setBranchProtection.test.d.ts +0 -1
- package/dist/domain.operations/branchProtection/setBranchProtection.test.js +0 -173
- package/dist/domain.operations/branchProtection/setBranchProtection.test.js.map +0 -1
- package/dist/domain.operations/provider/getDeclastructGithubProvider.integration.test.d.ts +0 -1
- package/dist/domain.operations/provider/getDeclastructGithubProvider.integration.test.js +0 -212
- package/dist/domain.operations/provider/getDeclastructGithubProvider.integration.test.js.map +0 -1
- package/dist/domain.operations/repo/getRepo.integration.test.d.ts +0 -1
- package/dist/domain.operations/repo/getRepo.integration.test.js +0 -45
- package/dist/domain.operations/repo/getRepo.integration.test.js.map +0 -1
- package/dist/domain.operations/repo/getRepos.integration.test.d.ts +0 -1
- package/dist/domain.operations/repo/getRepos.integration.test.js +0 -28
- package/dist/domain.operations/repo/getRepos.integration.test.js.map +0 -1
- package/dist/domain.operations/repo/setRepo.integration.test.d.ts +0 -1
- package/dist/domain.operations/repo/setRepo.integration.test.js +0 -29
- package/dist/domain.operations/repo/setRepo.integration.test.js.map +0 -1
- package/dist/domain.operations/repo/setRepo.test.d.ts +0 -1
- package/dist/domain.operations/repo/setRepo.test.js +0 -150
- package/dist/domain.operations/repo/setRepo.test.js.map +0 -1
- package/dist/domain.operations/repoConfig/getRepoConfig.integration.test.d.ts +0 -1
- package/dist/domain.operations/repoConfig/getRepoConfig.integration.test.js +0 -55
- package/dist/domain.operations/repoConfig/getRepoConfig.integration.test.js.map +0 -1
- package/dist/domain.operations/repoConfig/setRepoConfig.integration.test.d.ts +0 -1
- package/dist/domain.operations/repoConfig/setRepoConfig.integration.test.js +0 -87
- package/dist/domain.operations/repoConfig/setRepoConfig.integration.test.js.map +0 -1
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const getSampleGithubContext_1 = require("../../.test/assets/getSampleGithubContext");
|
|
4
|
-
const getSampleRepo_1 = require("../../.test/assets/getSampleRepo");
|
|
5
|
-
const getBranchProtection_1 = require("./getBranchProtection");
|
|
6
|
-
const setBranchProtection_1 = require("./setBranchProtection");
|
|
7
|
-
const log = console;
|
|
8
|
-
describe('setBranchProtection', () => {
|
|
9
|
-
const context = { log, ...(0, getSampleGithubContext_1.getSampleGithubContext)() };
|
|
10
|
-
describe('live tests', () => {
|
|
11
|
-
it('should update branch protection rules', async () => {
|
|
12
|
-
const sampleRepo = (0, getSampleRepo_1.getSampleRepo)({
|
|
13
|
-
owner: 'ehmpathy',
|
|
14
|
-
name: 'declastruct-github-demo',
|
|
15
|
-
});
|
|
16
|
-
// Get current protection (if any)
|
|
17
|
-
const currentProtection = await (0, getBranchProtection_1.getBranchProtection)({
|
|
18
|
-
by: {
|
|
19
|
-
unique: {
|
|
20
|
-
branch: {
|
|
21
|
-
repo: {
|
|
22
|
-
owner: sampleRepo.owner,
|
|
23
|
-
name: sampleRepo.name,
|
|
24
|
-
},
|
|
25
|
-
name: 'main',
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
}, context);
|
|
30
|
-
console.log('Current protection:', currentProtection);
|
|
31
|
-
// Update protection with upsert
|
|
32
|
-
const result = await (0, setBranchProtection_1.setBranchProtection)({
|
|
33
|
-
upsert: {
|
|
34
|
-
branch: {
|
|
35
|
-
repo: { owner: sampleRepo.owner, name: sampleRepo.name },
|
|
36
|
-
name: 'main',
|
|
37
|
-
},
|
|
38
|
-
enforceAdmins: false,
|
|
39
|
-
allowsDeletions: false,
|
|
40
|
-
allowsForcePushes: false,
|
|
41
|
-
requireLinearHistory: false,
|
|
42
|
-
requiredStatusChecks: null,
|
|
43
|
-
requiredPullRequestReviews: {
|
|
44
|
-
requiredApprovingReviewCount: 1,
|
|
45
|
-
},
|
|
46
|
-
restrictions: null,
|
|
47
|
-
},
|
|
48
|
-
}, context);
|
|
49
|
-
expect(result).toBeDefined();
|
|
50
|
-
expect(result.branch.repo.owner).toBe(sampleRepo.owner);
|
|
51
|
-
expect(result.branch.repo.name).toBe(sampleRepo.name);
|
|
52
|
-
expect(result.branch.name).toBe('main');
|
|
53
|
-
});
|
|
54
|
-
it('should return existing protection for finsert', async () => {
|
|
55
|
-
const sampleRepo = (0, getSampleRepo_1.getSampleRepo)({
|
|
56
|
-
owner: 'ehmpathy',
|
|
57
|
-
name: 'declastruct-github-demo',
|
|
58
|
-
});
|
|
59
|
-
// Get current protection
|
|
60
|
-
const currentProtection = await (0, getBranchProtection_1.getBranchProtection)({
|
|
61
|
-
by: {
|
|
62
|
-
unique: {
|
|
63
|
-
branch: {
|
|
64
|
-
repo: {
|
|
65
|
-
owner: sampleRepo.owner,
|
|
66
|
-
name: sampleRepo.name,
|
|
67
|
-
},
|
|
68
|
-
name: 'main',
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
}, context);
|
|
73
|
-
// Only run finsert test if protection exists
|
|
74
|
-
if (currentProtection) {
|
|
75
|
-
// Finsert should return existing protection without making changes
|
|
76
|
-
const result = await (0, setBranchProtection_1.setBranchProtection)({
|
|
77
|
-
finsert: {
|
|
78
|
-
branch: {
|
|
79
|
-
repo: { owner: sampleRepo.owner, name: sampleRepo.name },
|
|
80
|
-
name: 'main',
|
|
81
|
-
},
|
|
82
|
-
enforceAdmins: true,
|
|
83
|
-
allowsDeletions: true,
|
|
84
|
-
allowsForcePushes: true,
|
|
85
|
-
requireLinearHistory: true,
|
|
86
|
-
},
|
|
87
|
-
}, context);
|
|
88
|
-
expect(result).toBeDefined();
|
|
89
|
-
expect(result.branch.name).toBe('main');
|
|
90
|
-
// Should match current protection, not the finsert values
|
|
91
|
-
expect(result).toEqual(currentProtection);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
//# sourceMappingURL=setBranchProtection.integration.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setBranchProtection.integration.test.js","sourceRoot":"","sources":["../../../src/domain.operations/branchProtection/setBranchProtection.integration.test.ts"],"names":[],"mappings":";;AAAA,sFAAmF;AACnF,oEAAiE;AACjE,+DAA4D;AAC5D,+DAA4D;AAE5D,MAAM,GAAG,GAAG,OAAO,CAAC;AAEpB,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,GAAG,IAAA,+CAAsB,GAAE,EAAE,CAAC;IAErD,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;QAC1B,EAAE,CAAC,uCAAuC,EAAE,KAAK,IAAI,EAAE;YACrD,MAAM,UAAU,GAAG,IAAA,6BAAa,EAAC;gBAC/B,KAAK,EAAE,UAAU;gBACjB,IAAI,EAAE,yBAAyB;aAChC,CAAC,CAAC;YAEH,kCAAkC;YAClC,MAAM,iBAAiB,GAAG,MAAM,IAAA,yCAAmB,EACjD;gBACE,EAAE,EAAE;oBACF,MAAM,EAAE;wBACN,MAAM,EAAE;4BACN,IAAI,EAAE;gCACJ,KAAK,EAAE,UAAU,CAAC,KAAK;gCACvB,IAAI,EAAE,UAAU,CAAC,IAAI;6BACtB;4BACD,IAAI,EAAE,MAAM;yBACb;qBACF;iBACF;aACF,EACD,OAAO,CACR,CAAC;YAEF,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,iBAAiB,CAAC,CAAC;YAEtD,gCAAgC;YAChC,MAAM,MAAM,GAAG,MAAM,IAAA,yCAAmB,EACtC;gBACE,MAAM,EAAE;oBACN,MAAM,EAAE;wBACN,IAAI,EAAE,EAAE,KAA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I,iBAAiB,EAAE,CAAC;gBACtB,mEAAmE;gBACnE,MAAM,MAAM,GAAG,MAAM,IAAA,yCAAmB,EACtC;oBACE,OAAO,EAAE;wBACP,MAAM,EAAE;4BACN,IAAI,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE;4BACxD,IAAI,EAAE,MAAM;yBACb;wBACD,aAAa,EAAE,IAAI;wBACnB,eAAe,EAAE,IAAI;wBACrB,iBAAiB,EAAE,IAAI;wBACvB,oBAAoB,EAAE,IAAI;qBAC3B;iBACF,EACD,OAAO,CACR,CAAC;gBAEF,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;gBAC7B,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACxC,0DAA0D;gBAC1D,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const castModule = __importStar(require("./castToDeclaredGithubBranchProtection"));
|
|
27
|
-
const getBranchProtectionModule = __importStar(require("./getBranchProtection"));
|
|
28
|
-
// create mock functions first
|
|
29
|
-
const mockUpdateBranchProtection = jest.fn();
|
|
30
|
-
jest.mock('../../access/sdks/getGithubClient', () => ({
|
|
31
|
-
getGithubClient: jest.fn(() => ({
|
|
32
|
-
repos: {
|
|
33
|
-
updateBranchProtection: mockUpdateBranchProtection,
|
|
34
|
-
},
|
|
35
|
-
})),
|
|
36
|
-
}));
|
|
37
|
-
jest.mock('./castToDeclaredGithubBranchProtection');
|
|
38
|
-
jest.mock('./getBranchProtection');
|
|
39
|
-
const { setBranchProtection } = require('./setBranchProtection');
|
|
40
|
-
const context = {
|
|
41
|
-
github: { token: 'test-token' },
|
|
42
|
-
log: console,
|
|
43
|
-
};
|
|
44
|
-
const protectionSample = {
|
|
45
|
-
branch: {
|
|
46
|
-
repo: { owner: 'test-owner', name: 'test-repo' },
|
|
47
|
-
name: 'main',
|
|
48
|
-
},
|
|
49
|
-
enforceAdmins: true,
|
|
50
|
-
allowsDeletions: false,
|
|
51
|
-
allowsForcePushes: false,
|
|
52
|
-
requireLinearHistory: true,
|
|
53
|
-
requiredStatusChecks: {
|
|
54
|
-
strict: true,
|
|
55
|
-
contexts: ['ci/test'],
|
|
56
|
-
},
|
|
57
|
-
requiredPullRequestReviews: {
|
|
58
|
-
requiredApprovingReviewCount: 1,
|
|
59
|
-
dismissStaleReviews: true,
|
|
60
|
-
},
|
|
61
|
-
restrictions: null,
|
|
62
|
-
};
|
|
63
|
-
describe('setBranchProtection', () => {
|
|
64
|
-
beforeEach(() => {
|
|
65
|
-
jest.clearAllMocks();
|
|
66
|
-
});
|
|
67
|
-
it('returns early for finsert if protection already exists (before)', async () => {
|
|
68
|
-
const before = { ...protectionSample };
|
|
69
|
-
getBranchProtectionModule.getBranchProtection.mockResolvedValue(before);
|
|
70
|
-
const result = await setBranchProtection({ finsert: protectionSample }, context);
|
|
71
|
-
expect(result).toBe(before);
|
|
72
|
-
expect(getBranchProtectionModule.getBranchProtection).toHaveBeenCalled();
|
|
73
|
-
expect(mockUpdateBranchProtection).not.toHaveBeenCalled();
|
|
74
|
-
});
|
|
75
|
-
it('updates protection if upsert and protection exists (before)', async () => {
|
|
76
|
-
const before = { ...protectionSample };
|
|
77
|
-
getBranchProtectionModule.getBranchProtection.mockResolvedValue(before);
|
|
78
|
-
const updatedProtectionResponse = {
|
|
79
|
-
enforce_admins: { enabled: true },
|
|
80
|
-
allow_deletions: { enabled: false },
|
|
81
|
-
allow_force_pushes: { enabled: false },
|
|
82
|
-
required_linear_history: { enabled: true },
|
|
83
|
-
required_status_checks: {
|
|
84
|
-
strict: true,
|
|
85
|
-
contexts: ['ci/test'],
|
|
86
|
-
},
|
|
87
|
-
required_pull_request_reviews: {
|
|
88
|
-
required_approving_review_count: 1,
|
|
89
|
-
dismiss_stale_reviews: true,
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
mockUpdateBranchProtection.mockResolvedValue({
|
|
93
|
-
data: updatedProtectionResponse,
|
|
94
|
-
});
|
|
95
|
-
castModule.castToDeclaredGithubBranchProtection.mockReturnValue(protectionSample);
|
|
96
|
-
const result = await setBranchProtection({ upsert: protectionSample }, context);
|
|
97
|
-
expect(getBranchProtectionModule.getBranchProtection).toHaveBeenCalled();
|
|
98
|
-
expect(mockUpdateBranchProtection).toHaveBeenCalledWith({
|
|
99
|
-
owner: 'test-owner',
|
|
100
|
-
repo: 'test-repo',
|
|
101
|
-
branch: 'main',
|
|
102
|
-
enforce_admins: true,
|
|
103
|
-
allow_deletions: false,
|
|
104
|
-
allow_force_pushes: false,
|
|
105
|
-
required_linear_history: true,
|
|
106
|
-
block_creations: undefined,
|
|
107
|
-
lock_branch: undefined,
|
|
108
|
-
allow_fork_syncing: undefined,
|
|
109
|
-
required_status_checks: {
|
|
110
|
-
strict: true,
|
|
111
|
-
contexts: ['ci/test'],
|
|
112
|
-
},
|
|
113
|
-
required_pull_request_reviews: {
|
|
114
|
-
dismiss_stale_reviews: true,
|
|
115
|
-
require_code_owner_reviews: false,
|
|
116
|
-
required_approving_review_count: 1,
|
|
117
|
-
dismissal_restrictions: undefined,
|
|
118
|
-
},
|
|
119
|
-
restrictions: null,
|
|
120
|
-
required_conversation_resolution: undefined,
|
|
121
|
-
});
|
|
122
|
-
expect(result.branch.name).toEqual('main');
|
|
123
|
-
});
|
|
124
|
-
it('creates (updates) protection if protection does not exist (before = null)', async () => {
|
|
125
|
-
getBranchProtectionModule.getBranchProtection.mockResolvedValue(null);
|
|
126
|
-
const updatedProtectionResponse = {
|
|
127
|
-
enforce_admins: { enabled: true },
|
|
128
|
-
allow_deletions: { enabled: false },
|
|
129
|
-
allow_force_pushes: { enabled: false },
|
|
130
|
-
required_linear_history: { enabled: true },
|
|
131
|
-
required_status_checks: {
|
|
132
|
-
strict: true,
|
|
133
|
-
contexts: ['ci/test'],
|
|
134
|
-
},
|
|
135
|
-
required_pull_request_reviews: {
|
|
136
|
-
required_approving_review_count: 1,
|
|
137
|
-
dismiss_stale_reviews: true,
|
|
138
|
-
},
|
|
139
|
-
};
|
|
140
|
-
mockUpdateBranchProtection.mockResolvedValue({
|
|
141
|
-
data: updatedProtectionResponse,
|
|
142
|
-
});
|
|
143
|
-
castModule.castToDeclaredGithubBranchProtection.mockReturnValue(protectionSample);
|
|
144
|
-
const result = await setBranchProtection({ finsert: protectionSample }, context);
|
|
145
|
-
expect(getBranchProtectionModule.getBranchProtection).toHaveBeenCalled();
|
|
146
|
-
expect(mockUpdateBranchProtection).toHaveBeenCalledWith({
|
|
147
|
-
owner: 'test-owner',
|
|
148
|
-
repo: 'test-repo',
|
|
149
|
-
branch: 'main',
|
|
150
|
-
enforce_admins: true,
|
|
151
|
-
allow_deletions: false,
|
|
152
|
-
allow_force_pushes: false,
|
|
153
|
-
required_linear_history: true,
|
|
154
|
-
block_creations: undefined,
|
|
155
|
-
lock_branch: undefined,
|
|
156
|
-
allow_fork_syncing: undefined,
|
|
157
|
-
required_status_checks: {
|
|
158
|
-
strict: true,
|
|
159
|
-
contexts: ['ci/test'],
|
|
160
|
-
},
|
|
161
|
-
required_pull_request_reviews: {
|
|
162
|
-
dismiss_stale_reviews: true,
|
|
163
|
-
require_code_owner_reviews: false,
|
|
164
|
-
required_approving_review_count: 1,
|
|
165
|
-
dismissal_restrictions: undefined,
|
|
166
|
-
},
|
|
167
|
-
restrictions: null,
|
|
168
|
-
required_conversation_resolution: undefined,
|
|
169
|
-
});
|
|
170
|
-
expect(result.branch.name).toEqual('main');
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
//# sourceMappingURL=setBranchProtection.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setBranchProtection.test.js","sourceRoot":"","sources":["../../../src/domain.operations/branchProtection/setBranchProtection.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mFAAqE;AACrE,iFAAmE;AAEnE,8BAA8B;AAC9B,MAAM,0BAA0B,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAE7C,IAAI,CAAC,IAAI,CAAC,mCAAmC,EAAE,GAAG,EAAE,CAAC,CAAC;IACpD,eAAe,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAA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yB;SAChC,CAAC,CAAC;QAED,UAAU,CAAC,oCACZ,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAAC;QAEpC,MAAM,MAAM,GAAG,MAAM,mBAAmB,CACtC,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAC7B,OAAO,CACR,CAAC;QAEF,MAAM,CAAC,yBAAyB,CAAC,mBAAmB,CAAC,CAAC,gBAAgB,EAAE,CAAC;QACzE,MAAM,CAAC,0BAA0B,CAAC,CAAC,oBAAoB,CAAC;YACtD,KAAK,EAAE,YAAY;YACnB,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,MAAM;YACd,cAAc,EAAE,IAAI;YACpB,eAAe,EAAE,KAAK;YACtB,kBAAkB,EAAE,KAAK;YACzB,uBAAuB,EAAE,IAAI;YAC7B,eAAe,EAAE,SAAS;YAC1B,WAAW,EAAE,SAAS;YACtB,kBAAkB,EAAE,SAAS;YAC7B,sBAAsB,EAAE;gBACtB,MAAM,EAAE,IAAI;gBACZ,QAAQ,EAAE,CAAC,SAAS,CAAC;aACtB;YACD,6BAA6B,EAAE;gBAC7B,qBAAqB,EAAE,IAAI;gBAC3B,0BAA0B,EAAE,KAAK;gBACjC,+BAA+B,EAAE,CAAC;gBAClC,sBAAsB,EAAE,SAAS;aAClC;YACD,YAAY,EAAE,IAAI;YAClB,gCAAgC,EAAE,SAAS;SAC5C,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const test_fns_1 = require("test-fns");
|
|
4
|
-
const getSampleGithubContext_1 = require("../../.test/assets/getSampleGithubContext");
|
|
5
|
-
const DeclaredGithubBranchProtection_1 = require("../../domain.objects/DeclaredGithubBranchProtection");
|
|
6
|
-
const DeclaredGithubRepoConfig_1 = require("../../domain.objects/DeclaredGithubRepoConfig");
|
|
7
|
-
const getDeclastructGithubProvider_1 = require("./getDeclastructGithubProvider");
|
|
8
|
-
const log = console;
|
|
9
|
-
/**
|
|
10
|
-
* .what = integration tests for declastruct github provider
|
|
11
|
-
* .why = validates provider interface works correctly with real github API
|
|
12
|
-
*/
|
|
13
|
-
describe('getDeclastructGithubProvider', () => {
|
|
14
|
-
const githubContext = (0, getSampleGithubContext_1.getSampleGithubContext)();
|
|
15
|
-
(0, test_fns_1.given)('a declastruct github provider', () => {
|
|
16
|
-
// create provider with credentials
|
|
17
|
-
const provider = (0, getDeclastructGithubProvider_1.getDeclastructGithubProvider)({
|
|
18
|
-
credentials: {
|
|
19
|
-
token: githubContext.github.token,
|
|
20
|
-
},
|
|
21
|
-
}, { log });
|
|
22
|
-
(0, test_fns_1.then)('should have correct name', () => {
|
|
23
|
-
expect(provider.name).toBe('github');
|
|
24
|
-
});
|
|
25
|
-
(0, test_fns_1.then)('should have all required DAOs', () => {
|
|
26
|
-
expect(provider.daos.DeclaredGithubRepo).toBeDefined();
|
|
27
|
-
expect(provider.daos.DeclaredGithubBranch).toBeDefined();
|
|
28
|
-
expect(provider.daos.DeclaredGithubRepoConfig).toBeDefined();
|
|
29
|
-
expect(provider.daos.DeclaredGithubBranchProtection).toBeDefined();
|
|
30
|
-
});
|
|
31
|
-
(0, test_fns_1.then)('should have lifecycle hooks', () => {
|
|
32
|
-
expect(provider.hooks.beforeAll).toBeDefined();
|
|
33
|
-
expect(provider.hooks.afterAll).toBeDefined();
|
|
34
|
-
});
|
|
35
|
-
(0, test_fns_1.then)('should have github context with token', () => {
|
|
36
|
-
expect(provider.context.github.token).toBe(githubContext.github.token);
|
|
37
|
-
});
|
|
38
|
-
(0, test_fns_1.when)('using repo dao', () => {
|
|
39
|
-
const repoDao = provider.daos.DeclaredGithubRepo;
|
|
40
|
-
(0, test_fns_1.then)('should have get.byUnique method', () => {
|
|
41
|
-
expect(repoDao.get.byUnique).toBeDefined();
|
|
42
|
-
});
|
|
43
|
-
(0, test_fns_1.then)('should have get.byRef method', () => {
|
|
44
|
-
expect(repoDao.get.byRef).toBeDefined();
|
|
45
|
-
});
|
|
46
|
-
(0, test_fns_1.then)('should have set.finsert method', () => {
|
|
47
|
-
expect(repoDao.set.finsert).toBeDefined();
|
|
48
|
-
});
|
|
49
|
-
(0, test_fns_1.then)('should have set.upsert method', () => {
|
|
50
|
-
expect(repoDao.set.upsert).toBeDefined();
|
|
51
|
-
});
|
|
52
|
-
(0, test_fns_1.then)('can get repo by unique', async () => {
|
|
53
|
-
/**
|
|
54
|
-
* .what = validates byUnique can fetch existing repo from github
|
|
55
|
-
* .why = ensures read operations work correctly via provider interface
|
|
56
|
-
*/
|
|
57
|
-
const repo = await repoDao.get.byUnique({
|
|
58
|
-
owner: 'ehmpathy',
|
|
59
|
-
name: 'declastruct-github-demo',
|
|
60
|
-
}, provider.context);
|
|
61
|
-
// verify repo was fetched
|
|
62
|
-
expect(repo).toBeDefined();
|
|
63
|
-
expect(repo?.name).toBe('declastruct-github-demo');
|
|
64
|
-
expect(repo?.owner).toBe('ehmpathy');
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
(0, test_fns_1.when)('using branch dao', () => {
|
|
68
|
-
const branchDao = provider.daos.DeclaredGithubBranch;
|
|
69
|
-
(0, test_fns_1.then)('should have get.byUnique method', () => {
|
|
70
|
-
expect(branchDao.get.byUnique).toBeDefined();
|
|
71
|
-
});
|
|
72
|
-
(0, test_fns_1.then)('should have get.byRef method', () => {
|
|
73
|
-
expect(branchDao.get.byRef).toBeDefined();
|
|
74
|
-
});
|
|
75
|
-
(0, test_fns_1.then)('should have set.finsert method', () => {
|
|
76
|
-
expect(branchDao.set.finsert).toBeDefined();
|
|
77
|
-
});
|
|
78
|
-
(0, test_fns_1.then)('should have set.upsert method', () => {
|
|
79
|
-
expect(branchDao.set.upsert).toBeDefined();
|
|
80
|
-
});
|
|
81
|
-
(0, test_fns_1.then)('can get branch by unique', async () => {
|
|
82
|
-
/**
|
|
83
|
-
* .what = validates byUnique can fetch existing branch from github
|
|
84
|
-
* .why = ensures read operations work correctly via provider interface
|
|
85
|
-
*/
|
|
86
|
-
const branch = await branchDao.get.byUnique({
|
|
87
|
-
repo: { owner: 'ehmpathy', name: 'declastruct-github-demo' },
|
|
88
|
-
name: 'main',
|
|
89
|
-
}, provider.context);
|
|
90
|
-
// verify branch was fetched
|
|
91
|
-
expect(branch).toBeDefined();
|
|
92
|
-
expect(branch?.name).toBe('main');
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
(0, test_fns_1.when)('using repo config dao', () => {
|
|
96
|
-
const repoConfigDao = provider.daos.DeclaredGithubRepoConfig;
|
|
97
|
-
(0, test_fns_1.then)('should have get.byUnique method', () => {
|
|
98
|
-
expect(repoConfigDao.get.byUnique).toBeDefined();
|
|
99
|
-
});
|
|
100
|
-
(0, test_fns_1.then)('should have get.byRef method', () => {
|
|
101
|
-
expect(repoConfigDao.get.byRef).toBeDefined();
|
|
102
|
-
});
|
|
103
|
-
(0, test_fns_1.then)('should have set.finsert method', () => {
|
|
104
|
-
expect(repoConfigDao.set.finsert).toBeDefined();
|
|
105
|
-
});
|
|
106
|
-
(0, test_fns_1.then)('should have set.upsert method', () => {
|
|
107
|
-
expect(repoConfigDao.set.upsert).toBeDefined();
|
|
108
|
-
});
|
|
109
|
-
(0, test_fns_1.then)('can get repo config by unique', async () => {
|
|
110
|
-
/**
|
|
111
|
-
* .what = validates byUnique can fetch existing repo config from github
|
|
112
|
-
* .why = ensures read operations work correctly via provider interface
|
|
113
|
-
*/
|
|
114
|
-
const config = await repoConfigDao.get.byUnique({
|
|
115
|
-
repo: { owner: 'ehmpathy', name: 'declastruct-github-demo' },
|
|
116
|
-
}, provider.context);
|
|
117
|
-
// verify config was fetched
|
|
118
|
-
expect(config).toBeDefined();
|
|
119
|
-
expect(config?.repo.name).toBe('declastruct-github-demo');
|
|
120
|
-
});
|
|
121
|
-
(0, test_fns_1.then)('can upsert repo config idempotently', async () => {
|
|
122
|
-
/**
|
|
123
|
-
* .what = validates upsert creates or updates repo config on github
|
|
124
|
-
* .why = ensures write operations work correctly via provider interface
|
|
125
|
-
* .note = uses minimal safe configuration for demo repo
|
|
126
|
-
*/
|
|
127
|
-
// define desired repo configuration
|
|
128
|
-
const desiredConfig = DeclaredGithubRepoConfig_1.DeclaredGithubRepoConfig.as({
|
|
129
|
-
repo: { owner: 'ehmpathy', name: 'declastruct-github-demo' },
|
|
130
|
-
hasIssues: true,
|
|
131
|
-
hasProjects: false,
|
|
132
|
-
hasWiki: false,
|
|
133
|
-
hasDownloads: true,
|
|
134
|
-
isTemplate: false,
|
|
135
|
-
defaultBranch: 'main',
|
|
136
|
-
allowSquashMerge: true,
|
|
137
|
-
allowMergeCommit: false,
|
|
138
|
-
allowRebaseMerge: false,
|
|
139
|
-
allowAutoMerge: false,
|
|
140
|
-
deleteBranchOnMerge: true,
|
|
141
|
-
allowUpdateBranch: true,
|
|
142
|
-
});
|
|
143
|
-
// upsert
|
|
144
|
-
const result = await repoConfigDao.set.upsert(desiredConfig, provider.context);
|
|
145
|
-
// verify upsert succeeded
|
|
146
|
-
expect(result).toBeDefined();
|
|
147
|
-
expect(result.repo.name).toBe('declastruct-github-demo');
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
(0, test_fns_1.when)('using branch protection dao', () => {
|
|
151
|
-
const branchProtectionDao = provider.daos.DeclaredGithubBranchProtection;
|
|
152
|
-
(0, test_fns_1.then)('should have get.byUnique method', () => {
|
|
153
|
-
expect(branchProtectionDao.get.byUnique).toBeDefined();
|
|
154
|
-
});
|
|
155
|
-
(0, test_fns_1.then)('should have get.byRef method', () => {
|
|
156
|
-
expect(branchProtectionDao.get.byRef).toBeDefined();
|
|
157
|
-
});
|
|
158
|
-
(0, test_fns_1.then)('should have set.finsert method', () => {
|
|
159
|
-
expect(branchProtectionDao.set.finsert).toBeDefined();
|
|
160
|
-
});
|
|
161
|
-
(0, test_fns_1.then)('should have set.upsert method', () => {
|
|
162
|
-
expect(branchProtectionDao.set.upsert).toBeDefined();
|
|
163
|
-
});
|
|
164
|
-
(0, test_fns_1.then)('can get branch protection by unique', async () => {
|
|
165
|
-
/**
|
|
166
|
-
* .what = validates byUnique can fetch existing branch protection from github
|
|
167
|
-
* .why = ensures read operations work correctly via provider interface
|
|
168
|
-
*/
|
|
169
|
-
const protection = await branchProtectionDao.get.byUnique({
|
|
170
|
-
branch: {
|
|
171
|
-
repo: { owner: 'ehmpathy', name: 'declastruct-github-demo' },
|
|
172
|
-
name: 'main',
|
|
173
|
-
},
|
|
174
|
-
}, provider.context);
|
|
175
|
-
// verify protection was fetched (may be null if not configured)
|
|
176
|
-
expect(protection !== undefined).toBe(true);
|
|
177
|
-
});
|
|
178
|
-
(0, test_fns_1.then)('can upsert branch protection idempotently', async () => {
|
|
179
|
-
/**
|
|
180
|
-
* .what = validates upsert creates or updates branch protection on github
|
|
181
|
-
* .why = ensures write operations work correctly via provider interface
|
|
182
|
-
* .note = uses idempotent operation safe for demo repo
|
|
183
|
-
*/
|
|
184
|
-
// define desired protection configuration
|
|
185
|
-
const desiredProtection = DeclaredGithubBranchProtection_1.DeclaredGithubBranchProtection.as({
|
|
186
|
-
branch: {
|
|
187
|
-
repo: { owner: 'ehmpathy', name: 'declastruct-github-demo' },
|
|
188
|
-
name: 'main',
|
|
189
|
-
},
|
|
190
|
-
requiredStatusChecks: null,
|
|
191
|
-
enforceAdmins: false,
|
|
192
|
-
requiredPullRequestReviews: null,
|
|
193
|
-
restrictions: null,
|
|
194
|
-
requireLinearHistory: false,
|
|
195
|
-
allowsForcePushes: false,
|
|
196
|
-
allowsDeletions: false,
|
|
197
|
-
blockCreations: false,
|
|
198
|
-
requiredConversationResolution: false,
|
|
199
|
-
lockBranch: false,
|
|
200
|
-
allowForkSyncing: false,
|
|
201
|
-
});
|
|
202
|
-
// upsert
|
|
203
|
-
const result = await branchProtectionDao.set.upsert(desiredProtection, provider.context);
|
|
204
|
-
// verify upsert succeeded
|
|
205
|
-
expect(result).toBeDefined();
|
|
206
|
-
expect(result.branch.name).toBe('main');
|
|
207
|
-
expect(result.branch.repo.name).toBe('declastruct-github-demo');
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
//# sourceMappingURL=getDeclastructGithubProvider.integration.test.js.map
|
package/dist/domain.operations/provider/getDeclastructGithubProvider.integration.test.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getDeclastructGithubProvider.integration.test.js","sourceRoot":"","sources":["../../../src/domain.operations/provider/getDeclastructGithubProvider.integration.test.ts"],"names":[],"mappings":";;AAAA,uCAA6C;AAE7C,sFAAmF;AACnF,wGAAqG;AACrG,4FAAyF;AACzF,iFAA8E;AAE9E,MAAM,GAAG,GAAG,OAAO,CAAC;AAEpB;;;GAGG;AACH,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC5C,MAAM,aAAa,GAAG,IAAA,+CAAsB,GAAE,CAAC;IAE/C,IAAA,gBAAK,EAAC,+BAA+B,EAAE,GAAG,EAAE;QAC1C,mCAAmC;QACnC,MAAM,QAAQ,GAAG,IAAA,2DAA4B,EAC3C;YACE,WAAW,EAAE;gBACX,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK;aAClC;SACF,EACD,EAAE,GAAG,EAAE,CACR,CAAC;QAEF,IAAA,eAAI,EAAC,0BAA0B,EAAE,GAAG,EAAE;YACpC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QAEH,IAAA,eAAI,EAAC,+BAA+B,EAAE,GAAG,EAAE;YACzC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,CA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,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;YAClE,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const test_fns_1 = require("test-fns");
|
|
4
|
-
const getSampleGithubContext_1 = require("../../.test/assets/getSampleGithubContext");
|
|
5
|
-
const getSampleRepo_1 = require("../../.test/assets/getSampleRepo");
|
|
6
|
-
const getRepo_1 = require("./getRepo");
|
|
7
|
-
const log = console;
|
|
8
|
-
describe('getRepo', () => {
|
|
9
|
-
const context = { log, ...(0, getSampleGithubContext_1.getSampleGithubContext)() };
|
|
10
|
-
(0, test_fns_1.given)('a live example repo exists', () => {
|
|
11
|
-
(0, test_fns_1.then)('we should be able to get its state', async () => {
|
|
12
|
-
const sampleRepo = (0, getSampleRepo_1.getSampleRepo)({
|
|
13
|
-
owner: 'ehmpathy',
|
|
14
|
-
name: 'declastruct-github',
|
|
15
|
-
});
|
|
16
|
-
const repo = await (0, getRepo_1.getRepo)({
|
|
17
|
-
by: {
|
|
18
|
-
unique: {
|
|
19
|
-
owner: sampleRepo.owner,
|
|
20
|
-
name: sampleRepo.name,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
}, context);
|
|
24
|
-
console.log(repo);
|
|
25
|
-
expect(repo).toBeDefined();
|
|
26
|
-
expect(repo?.name).toBe(sampleRepo.name);
|
|
27
|
-
expect(repo?.owner).toBe(sampleRepo.owner);
|
|
28
|
-
expect(repo?.id).toBeDefined();
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
(0, test_fns_1.given)('a repo that does not exist', () => {
|
|
32
|
-
(0, test_fns_1.then)('it should return null', async () => {
|
|
33
|
-
const repo = await (0, getRepo_1.getRepo)({
|
|
34
|
-
by: {
|
|
35
|
-
unique: {
|
|
36
|
-
owner: 'ehmpathy',
|
|
37
|
-
name: 'repo-that-does-not-exist-99999',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
}, context);
|
|
41
|
-
expect(repo).toBeNull();
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
//# sourceMappingURL=getRepo.integration.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getRepo.integration.test.js","sourceRoot":"","sources":["../../../src/domain.operations/repo/getRepo.integration.test.ts"],"names":[],"mappings":";;AAAA,uCAAuC;AAEvC,sFAAmF;AACnF,oEAAiE;AACjE,uCAAoC;AAEpC,MAAM,GAAG,GAAG,OAAO,CAAC;AAEpB,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,GAAG,IAAA,+CAAsB,GAAE,EAAE,CAAC;IAErD,IAAA,gBAAK,EAAC,4BAA4B,EAAE,GAAG,EAAE;QACvC,IAAA,eAAI,EAAC,oCAAoC,EAAE,KAAK,IAAI,EAAE;YACpD,MAAM,UAAU,GAAG,IAAA,6BAAa,EAAC;gBAC/B,KAAK,EAAE,UAAU;gBACjB,IAAI,EAAE,oBAAoB;aAC3B,CAAC,CAAC;YAEH,MAAM,IAAI,GAAG,MAAM,IAAA,iBAAO,EACxB;gBACE,EAAE,EAAE;oBACF,MAAM,EAAE;wBACN,KAAK,EAAE,UAAU,CAAC,KAAK;wBACvB,IAAI,EAAE,UAAU,CAAC,IAAI;qBACtB;iBACF;aACF,EACD,OAAO,CACR,CAAC;YAEF,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAClB,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;YAC3B,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YACzC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YAC3C,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,gBAAK,EAAC,4BAA4B,EAAE,GAAG,EAAE;QACvC,IAAA,eAAI,EAAC,uBAAuB,EAAE,KAAK,IAAI,EAAE;YACvC,MAAM,IAAI,GAAG,MAAM,IAAA,iBAAO,EACxB;gBACE,EAAE,EAAE;oBACF,MAAM,EAAE;wBACN,KAAK,EAAE,UAAU;wBACjB,IAAI,EAAE,gCAAgC;qBACvC;iBACF;aACF,EACD,OAAO,CACR,CAAC;YAEF,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const test_fns_1 = require("test-fns");
|
|
4
|
-
const getSampleGithubContext_1 = require("../../.test/assets/getSampleGithubContext");
|
|
5
|
-
const getRepos_1 = require("./getRepos");
|
|
6
|
-
const log = console;
|
|
7
|
-
describe('getRepos', () => {
|
|
8
|
-
const context = { log, ...(0, getSampleGithubContext_1.getSampleGithubContext)() };
|
|
9
|
-
(0, test_fns_1.given)('an authenticated user with repos', () => {
|
|
10
|
-
(0, test_fns_1.then)('we should be able to get a list', async () => {
|
|
11
|
-
const repos = await (0, getRepos_1.getRepos)({ page: { limit: 10 } }, context);
|
|
12
|
-
console.log(repos);
|
|
13
|
-
expect(repos.length).toBeGreaterThan(0);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
(0, test_fns_1.given)('a specific owner', () => {
|
|
17
|
-
(0, test_fns_1.then)('we should be able to list their repos', async () => {
|
|
18
|
-
const repos = await (0, getRepos_1.getRepos)({
|
|
19
|
-
where: { owner: 'ehmpathy' },
|
|
20
|
-
page: { limit: 5 },
|
|
21
|
-
}, context);
|
|
22
|
-
console.log(repos);
|
|
23
|
-
expect(repos.length).toBeGreaterThan(0);
|
|
24
|
-
expect(repos.every((repo) => repo.owner === 'ehmpathy')).toBe(true);
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
//# sourceMappingURL=getRepos.integration.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getRepos.integration.test.js","sourceRoot":"","sources":["../../../src/domain.operations/repo/getRepos.integration.test.ts"],"names":[],"mappings":";;AAAA,uCAAuC;AAEvC,sFAAmF;AACnF,yCAAsC;AAEtC,MAAM,GAAG,GAAG,OAAO,CAAC;AAEpB,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,GAAG,IAAA,+CAAsB,GAAE,EAAE,CAAC;IAErD,IAAA,gBAAK,EAAC,kCAAkC,EAAE,GAAG,EAAE;QAC7C,IAAA,eAAI,EAAC,iCAAiC,EAAE,KAAK,IAAI,EAAE;YACjD,MAAM,KAAK,GAAG,MAAM,IAAA,mBAAQ,EAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;YAC/D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACnB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,gBAAK,EAAC,kBAAkB,EAAE,GAAG,EAAE;QAC7B,IAAA,eAAI,EAAC,uCAAuC,EAAE,KAAK,IAAI,EAAE;YACvD,MAAM,KAAK,GAAG,MAAM,IAAA,mBAAQ,EAC1B;gBACE,KAAK,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE;gBAC5B,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE;aACnB,EACD,OAAO,CACR,CAAC;YACF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACnB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;YACxC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const test_fns_1 = require("test-fns");
|
|
4
|
-
const getSampleGithubContext_1 = require("../../.test/assets/getSampleGithubContext");
|
|
5
|
-
const log = console;
|
|
6
|
-
describe('setRepo', () => {
|
|
7
|
-
const context = { log, ...(0, getSampleGithubContext_1.getSampleGithubContext)() };
|
|
8
|
-
(0, test_fns_1.given)('a repo declaration for finsert', () => {
|
|
9
|
-
(0, test_fns_1.then)('it should return existing repo if it exists', async () => {
|
|
10
|
-
/**
|
|
11
|
-
* .note = this test is skipped because setRepo requires permissions
|
|
12
|
-
* to create/update repos which may not be available in all test environments
|
|
13
|
-
* .what = validates that finsert returns existing repo without modification
|
|
14
|
-
*/
|
|
15
|
-
expect(true).toBe(true); // placeholder
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
(0, test_fns_1.given)('a repo declaration for upsert', () => {
|
|
19
|
-
(0, test_fns_1.then)('it should create or update the repo', async () => {
|
|
20
|
-
/**
|
|
21
|
-
* .note = this test is skipped because setRepo requires write permissions
|
|
22
|
-
* which may not be available in integration test environment
|
|
23
|
-
* .what = validates that upsert creates new repo or updates existing one
|
|
24
|
-
*/
|
|
25
|
-
expect(true).toBe(true); // placeholder
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
//# sourceMappingURL=setRepo.integration.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setRepo.integration.test.js","sourceRoot":"","sources":["../../../src/domain.operations/repo/setRepo.integration.test.ts"],"names":[],"mappings":";;AAAA,uCAAuC;AAEvC,sFAAmF;AAGnF,MAAM,GAAG,GAAG,OAAO,CAAC;AAEpB,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,GAAG,IAAA,+CAAsB,GAAE,EAAE,CAAC;IAErD,IAAA,gBAAK,EAAC,gCAAgC,EAAE,GAAG,EAAE;QAC3C,IAAA,eAAI,EAAC,6CAA6C,EAAE,KAAK,IAAI,EAAE;YAC7D;;;;eAIG;YACH,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;QACzC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,gBAAK,EAAC,+BAA+B,EAAE,GAAG,EAAE;QAC1C,IAAA,eAAI,EAAC,qCAAqC,EAAE,KAAK,IAAI,EAAE;YACrD;;;;eAIG;YACH,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;QACzC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|