diff --git a/test/acl.test.js b/test/acl.test.js index a52ef81..8d4c0d7 100644 --- a/test/acl.test.js +++ b/test/acl.test.js @@ -7,8 +7,8 @@ test('acl', async t => { t.test('setACL', async t => { const aclObj = acl.setACL(repoName) t.is(aclObj.visibility, 'public') - t.is(aclObj.protectedBranches.length, 1) - t.is(aclObj.protectedBranches[0], 'master') + t.is(aclObj.protectedBranches.length, 2) + t.ok(aclObj.protectedBranches.includes('master') && aclObj.protectedBranches.includes('main')) t.is(Object.keys(aclObj.ACL).length, 0) }) @@ -34,12 +34,12 @@ test('acl', async t => { test('addProtectedBranch', async t => { acl.addProtectedBranch(repoName, 'branch1') - t.is(acl.getACL(repoName).protectedBranches.length, 2) + t.is(acl.getACL(repoName).protectedBranches.length, 3) }) test('removeProtectedBranch', async t => { acl.removeProtectedBranch(repoName, 'branch1') - t.is(acl.getACL(repoName).protectedBranches.length, 1) + t.is(acl.getACL(repoName).protectedBranches.length, 2) }) test('getAdmins', async t => { diff --git a/test/git.test.js b/test/git.test.js index efed0bf..b06ab9d 100644 --- a/test/git.test.js +++ b/test/git.test.js @@ -51,13 +51,13 @@ test('git - uploadPack (w have)', { skip: true }, async t => { }) test('git - createBareRepo', async t => { - t.absent(fs.existsSync(path.join(home.APP_HOME, 'test-git', 'code'))) + t.absent(fs.existsSync(path.join(home.APP_HOME, 'test-git'))) home.createAppFolder('test-git') - t.absent(fs.existsSync(path.join(home.APP_HOME, 'test-git', 'code', 'HEAD'))) + t.absent(fs.existsSync(path.join(home.APP_HOME, 'test-git', 'HEAD'))) await git.createBareRepo('test-git') - t.ok(fs.existsSync(path.join(home.APP_HOME, 'test-git', 'code', 'HEAD'))) + t.ok(fs.existsSync(path.join(home.APP_HOME, 'test-git', 'HEAD'))) t.teardown(() => { fs.rmSync(path.join(home.APP_HOME, 'test-git'), { recursive: true }) diff --git a/test/home.test.js b/test/home.test.js index 2381886..9980b06 100644 --- a/test/home.test.js +++ b/test/home.test.js @@ -11,7 +11,7 @@ test('getAppHome', t => { test('createAppFolder, share, is shared, unshare, isInitialized, list, getCodePath', t => { home.createAppFolder('test_code') - t.ok(fs.existsSync(path.join(home.APP_HOME, 'test_code', 'code'))) + t.ok(fs.existsSync(path.join(home.APP_HOME, 'test_code'))) t.absent(home.isShared('test_code')) t.absent(fs.existsSync(path.join(home.APP_HOME, 'test_code', '.git-daemon-export-ok'))) @@ -32,7 +32,7 @@ test('createAppFolder, share, is shared, unshare, isInitialized, list, getCodePa t.alike(new Set(home.list()), new Set(['foo', 'bar', 'zar'])) t.alike(new Set(home.list(true)), new Set(['foo', 'bar'])) - t.alike(path.resolve(home.getCodePath('test_code')), path.resolve(path.join(home.APP_HOME, 'test_code', 'code'))) + t.alike(path.resolve(home.getCodePath('test_code')), path.resolve(path.join(home.APP_HOME, 'test_code'))) t.teardown(() => { fs.rmSync(path.join(home.APP_HOME, 'test_code'), { recursive: true })