Skip to content

Commit

Permalink
chore: add new tests and cleanup deprecated ones
Browse files Browse the repository at this point in the history
  • Loading branch information
tale committed Feb 15, 2022
1 parent 9c72b3f commit 7eaf388
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 7 deletions.
40 changes: 37 additions & 3 deletions src/control.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { readFile } from 'node:fs/promises'
import { Control } from '.'
import { BinaryControl } from '.'

test('control:clang', async () => {
const data = await readFile('test/clang.control', 'utf8')
const control = new Control(data)

const control = new BinaryControl(data)

expect(control.package).toEqual('clang')
expect(control.source).toEqual('llvm-defaults (0.54)')
Expand Down Expand Up @@ -38,3 +37,38 @@ test('control:clang', async () => {

expect(control.description).toEqual('C, C++ and Objective-C compiler (LLVM based), clang binary Clang project is a C, C++, Objective C and Objective C++ front-end for the LLVM compiler. Its goal is to offer a replacement to the GNU Compiler Collection (GCC). Clang implements all of the ISO C++ 1998, 11 and 14 standards and also provides most of the support of C++17. This is a dependency package providing the default clang compiler.')
})

test('control:com.amywhile.signalreborn', async () => {
const data = await readFile('test/com.amywhile.signalreborn.control', 'utf8')
const control = new BinaryControl(data)

expect(control.package).toEqual('com.amywhile.signalreborn')
expect(control.architecture).toEqual('iphoneos-arm')
expect(control.description).toEqual('Visualise your nearby cell towers')
expect(control.depends).toEqual(expect.arrayContaining([
'firmware (>= 12.2) | org.swift.libswift'
]))

expect(control.conflicts).toEqual(expect.arrayContaining([
'com.charliewhile.signalreborn'
]))

expect(control.replaces).toEqual(expect.arrayContaining([
'com.charliewhile.signalreborn'
]))

expect(control.breaks).toEqual(expect.arrayContaining([
'com.charliewhile.signalreborn'
]))

expect(control.maintainer).toEqual('Amy While <support@anamy.gay>')
expect(control.section).toEqual('Applications')
expect(control.version).toEqual('2.2.1-2')
expect(control.installedSize).toEqual(1536)

expect(control.get('Name')).toEqual('SignalReborn')
expect(control.get('Author')).toEqual('Amy While <support@anamy.gay>')
expect(control.get('Tag')).toEqual('compatible_min::ios11.0')
expect(control.get('Icon')).toEqual('https://img.chariz.cloud/icon/signal/icon@3x.png')
expect(control.get('Depiction')).toEqual('https://chariz.com/get/signal')
})
8 changes: 4 additions & 4 deletions src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import { readFile } from 'node:fs/promises'
import { parsePackages, parseRelease } from '.'

test('release:chariz', async () => {
test('deprecated:release:chariz', async () => {
const data = await readFile('test/chariz.release', 'utf8')
const map = parseRelease(data)
expect(map).toBeDefined()
})

test('release:jammy', async () => {
test('deprecated:release:jammy', async () => {
const data = await readFile('test/jammy.release', 'utf8')
const map = parseRelease(data)
expect(map).toBeDefined()
})

test('packages:chariz', async () => {
test('deprecated:packages:chariz', async () => {
const data = await readFile('test/chariz.packages', 'utf8')
const map = parsePackages(data)
expect(map.length).toBe(415)
})

test('packages:jammy', async () => {
test('deprecated:packages:jammy', async () => {
const data = await readFile('test/jammy.packages', 'utf8')
const map = parsePackages(data)
expect(map.length).toBe(6132)
Expand Down
16 changes: 16 additions & 0 deletions test/com.amywhile.signalreborn.control
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Package: com.amywhile.signalreborn
Name: SignalReborn
Architecture: iphoneos-arm
Description: Visualise your nearby cell towers
Depends: firmware (>= 12.2) | org.swift.libswift
Conflicts: com.charliewhile.signalreborn
Replaces: com.charliewhile.signalreborn
Breaks: com.charliewhile.signalreborn
Author: Amy While <support@anamy.gay>
Maintainer: Amy While <support@anamy.gay>
Section: Applications
Version: 2.2.1-2
Tag: compatible_min::ios11.0
Icon: https://img.chariz.cloud/icon/signal/icon@3x.png
Depiction: https://chariz.com/get/signal
Installed-Size: 1536

0 comments on commit 7eaf388

Please sign in to comment.