test: fix acl tests

Signed-off-by: dzdidi <deniszalessky@gmail.com>
This commit is contained in:
dzdidi
2024-02-15 19:46:45 +00:00
parent 6e97646676
commit 4b2dac17ef
3 changed files with 9 additions and 9 deletions

View File

@@ -7,8 +7,8 @@ test('acl', async t => {
t.test('setACL', async t => { t.test('setACL', async t => {
const aclObj = acl.setACL(repoName) const aclObj = acl.setACL(repoName)
t.is(aclObj.visibility, 'public') t.is(aclObj.visibility, 'public')
t.is(aclObj.protectedBranches.length, 1) t.is(aclObj.protectedBranches.length, 2)
t.is(aclObj.protectedBranches[0], 'master') t.ok(aclObj.protectedBranches.includes('master') && aclObj.protectedBranches.includes('main'))
t.is(Object.keys(aclObj.ACL).length, 0) t.is(Object.keys(aclObj.ACL).length, 0)
}) })
@@ -34,12 +34,12 @@ test('acl', async t => {
test('addProtectedBranch', async t => { test('addProtectedBranch', async t => {
acl.addProtectedBranch(repoName, 'branch1') acl.addProtectedBranch(repoName, 'branch1')
t.is(acl.getACL(repoName).protectedBranches.length, 2) t.is(acl.getACL(repoName).protectedBranches.length, 3)
}) })
test('removeProtectedBranch', async t => { test('removeProtectedBranch', async t => {
acl.removeProtectedBranch(repoName, 'branch1') acl.removeProtectedBranch(repoName, 'branch1')
t.is(acl.getACL(repoName).protectedBranches.length, 1) t.is(acl.getACL(repoName).protectedBranches.length, 2)
}) })
test('getAdmins', async t => { test('getAdmins', async t => {

View File

@@ -51,13 +51,13 @@ test('git - uploadPack (w have)', { skip: true }, async t => {
}) })
test('git - createBareRepo', 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') 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') 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(() => { t.teardown(() => {
fs.rmSync(path.join(home.APP_HOME, 'test-git'), { recursive: true }) fs.rmSync(path.join(home.APP_HOME, 'test-git'), { recursive: true })

View File

@@ -11,7 +11,7 @@ test('getAppHome', t => {
test('createAppFolder, share, is shared, unshare, isInitialized, list, getCodePath', t => { test('createAppFolder, share, is shared, unshare, isInitialized, list, getCodePath', t => {
home.createAppFolder('test_code') 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(home.isShared('test_code'))
t.absent(fs.existsSync(path.join(home.APP_HOME, 'test_code', '.git-daemon-export-ok'))) 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()), new Set(['foo', 'bar', 'zar']))
t.alike(new Set(home.list(true)), new Set(['foo', 'bar'])) 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(() => { t.teardown(() => {
fs.rmSync(path.join(home.APP_HOME, 'test_code'), { recursive: true }) fs.rmSync(path.join(home.APP_HOME, 'test_code'), { recursive: true })