initial commit
This commit is contained in:
41
test/pkgbase.test.ts
Normal file
41
test/pkgbase.test.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import path from 'path';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { parse, type Result } from '../src/pkgbase.js';
|
||||
|
||||
describe('pkgbase parser', () => {
|
||||
it('can detect an add operation', async () => {
|
||||
const expected: Result = {
|
||||
build: true,
|
||||
move: false,
|
||||
delete: [],
|
||||
actions: {
|
||||
addRepo: 'system-goblins',
|
||||
removeRepo: null,
|
||||
triggersBuild: false,
|
||||
triggersRebuild: true,
|
||||
triggersRepoAdd: true,
|
||||
triggersRepoRemove: false,
|
||||
triggersNoCheck: false
|
||||
}
|
||||
};
|
||||
await expect(parse(path.join('test', 'resources', 'add-clean', 'pkgbase.old.yaml'), path.join('test', 'resources', 'add-clean', 'pkgbase.new.yaml'))).resolves.toEqual(expected);
|
||||
});
|
||||
|
||||
it('can remove dangling packages in an add operation', async () => {
|
||||
const expected: Result = {
|
||||
build: true,
|
||||
move: false,
|
||||
delete: ['pidgin'],
|
||||
actions: {
|
||||
addRepo: 'world',
|
||||
removeRepo: null,
|
||||
triggersBuild: true,
|
||||
triggersRebuild: false,
|
||||
triggersRepoAdd: true,
|
||||
triggersRepoRemove: false,
|
||||
triggersNoCheck: false
|
||||
}
|
||||
};
|
||||
await expect(parse(path.join('test', 'resources', 'add-with-dropped', 'pkgbase.old.yaml'), path.join('test', 'resources', 'add-with-dropped', 'pkgbase.new.yaml'))).resolves.toEqual(expected);
|
||||
});
|
||||
});
|
||||
61
test/resources/add-clean/pkgbase.new.yaml
Normal file
61
test/resources/add-clean/pkgbase.new.yaml
Normal file
@@ -0,0 +1,61 @@
|
||||
---
|
||||
actions:
|
||||
addRepo: system-goblins
|
||||
removeRepo: null
|
||||
triggersBuild: false
|
||||
triggersRebuild: true
|
||||
triggersRepoAdd: true
|
||||
triggersRepoRemove: false
|
||||
triggersNoCheck: false
|
||||
repos:
|
||||
system-goblins:
|
||||
version: 78.1-1
|
||||
packages:
|
||||
- icu-78.1-1-x86_64.pkg.tar.zst
|
||||
debug: []
|
||||
system-gremlins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
system:
|
||||
version: 76.1-1
|
||||
packages:
|
||||
- icu-76.1-1-x86_64.pkg.tar.zst
|
||||
debug: []
|
||||
world-goblins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
world-gremlins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
world:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
lib32-goblins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
lib32-gremlins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
lib32:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
galaxy-goblins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
galaxy-gremlins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
galaxy:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
team: system
|
||||
55
test/resources/add-clean/pkgbase.old.yaml
Normal file
55
test/resources/add-clean/pkgbase.old.yaml
Normal file
@@ -0,0 +1,55 @@
|
||||
---
|
||||
pkgbase:
|
||||
name: icu
|
||||
version: 76.1-1
|
||||
arch:
|
||||
- x86_64
|
||||
pkgname:
|
||||
- icu
|
||||
actions:
|
||||
addRepo: system
|
||||
removeRepo: system-gremlins
|
||||
triggersBuild: false
|
||||
triggersRebuild: false
|
||||
triggersRepoAdd: true
|
||||
triggersRepoRemove: true
|
||||
triggersNoCheck: false
|
||||
repos:
|
||||
system-goblins:
|
||||
version: null
|
||||
packages: []
|
||||
system-gremlins:
|
||||
version: null
|
||||
packages: []
|
||||
system:
|
||||
version: 76.1-1
|
||||
packages:
|
||||
- icu-76.1-1-x86_64.pkg.tar.zst
|
||||
world-goblins:
|
||||
version: null
|
||||
packages: []
|
||||
world-gremlins:
|
||||
version: null
|
||||
packages: []
|
||||
world:
|
||||
version: null
|
||||
packages: []
|
||||
lib32-goblins:
|
||||
version: null
|
||||
packages: []
|
||||
lib32-gremlins:
|
||||
version: null
|
||||
packages: []
|
||||
lib32:
|
||||
version: null
|
||||
packages: []
|
||||
galaxy-goblins:
|
||||
version: null
|
||||
packages: []
|
||||
galaxy-gremlins:
|
||||
version: null
|
||||
packages: []
|
||||
galaxy:
|
||||
version: null
|
||||
packages: []
|
||||
team: system
|
||||
61
test/resources/add-with-dropped/pkgbase.new.yaml
Normal file
61
test/resources/add-with-dropped/pkgbase.new.yaml
Normal file
@@ -0,0 +1,61 @@
|
||||
---
|
||||
actions:
|
||||
addRepo: world
|
||||
removeRepo: null
|
||||
triggersBuild: true
|
||||
triggersRebuild: false
|
||||
triggersRepoAdd: true
|
||||
triggersRepoRemove: false
|
||||
triggersNoCheck: false
|
||||
repos:
|
||||
system-goblins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
system-gremlins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
system:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
world-goblins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
world-gremlins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
world:
|
||||
version: 2.14.14-4
|
||||
packages:
|
||||
- libpurple-2.14.14-4-x86_64.pkg.tar.zst
|
||||
- finch-2.14.14-4-x86_64.pkg.tar.zst
|
||||
debug: []
|
||||
lib32-goblins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
lib32-gremlins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
lib32:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
galaxy-goblins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
galaxy-gremlins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
galaxy:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
team: world
|
||||
62
test/resources/add-with-dropped/pkgbase.old.yaml
Normal file
62
test/resources/add-with-dropped/pkgbase.old.yaml
Normal file
@@ -0,0 +1,62 @@
|
||||
---
|
||||
actions:
|
||||
addRepo: world
|
||||
removeRepo: world-gremlins
|
||||
triggersBuild: false
|
||||
triggersRebuild: false
|
||||
triggersRepoAdd: true
|
||||
triggersRepoRemove: true
|
||||
triggersNoCheck: false
|
||||
repos:
|
||||
system-goblins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
system-gremlins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
system:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
world-goblins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
world-gremlins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
world:
|
||||
version: 2.14.14-3
|
||||
packages:
|
||||
- pidgin-2.14.14-3-x86_64.pkg.tar.zst
|
||||
- libpurple-2.14.14-3-x86_64.pkg.tar.zst
|
||||
- finch-2.14.14-3-x86_64.pkg.tar.zst
|
||||
debug: []
|
||||
lib32-goblins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
lib32-gremlins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
lib32:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
galaxy-goblins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
galaxy-gremlins:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
galaxy:
|
||||
version: null
|
||||
packages: []
|
||||
debug: []
|
||||
team: world
|
||||
Reference in New Issue
Block a user