From 9e24787443a049c9af91684dfe0a049bc60c6f86 Mon Sep 17 00:00:00 2001 From: Aarnav Tale Date: Tue, 22 Feb 2022 13:00:43 -0500 Subject: [PATCH] chore: refactor tests --- {src => test}/control.test.ts | 6 +++--- test/{ => files}/chariz.packages | 0 test/{ => files}/chariz.release | 0 test/{ => files}/clang.control | 0 test/{ => files}/com.amywhile.signalreborn.control | 0 test/{ => files}/jammy.packages | 0 test/{ => files}/jammy.release | 0 {src => test}/index.test.ts | 10 +++++----- {src => test}/packages.test.ts | 6 +++--- {src => test}/release.test.ts | 6 +++--- 10 files changed, 14 insertions(+), 14 deletions(-) rename {src => test}/control.test.ts (93%) rename test/{ => files}/chariz.packages (100%) rename test/{ => files}/chariz.release (100%) rename test/{ => files}/clang.control (100%) rename test/{ => files}/com.amywhile.signalreborn.control (100%) rename test/{ => files}/jammy.packages (100%) rename test/{ => files}/jammy.release (100%) rename {src => test}/index.test.ts (61%) rename {src => test}/packages.test.ts (95%) rename {src => test}/release.test.ts (93%) diff --git a/src/control.test.ts b/test/control.test.ts similarity index 93% rename from src/control.test.ts rename to test/control.test.ts index 5a2f381..b6fd144 100644 --- a/src/control.test.ts +++ b/test/control.test.ts @@ -1,8 +1,8 @@ import { readFile } from 'node:fs/promises' -import { BinaryControl } from '.' +import { BinaryControl } from '../src' test('control:clang', async () => { - const data = await readFile('test/clang.control', 'utf8') + const data = await readFile('test/files/clang.control', 'utf8') const control = new BinaryControl(data) expect(control.package).toEqual('clang') @@ -39,7 +39,7 @@ test('control:clang', async () => { }) test('control:com.amywhile.signalreborn', async () => { - const data = await readFile('test/com.amywhile.signalreborn.control', 'utf8') + const data = await readFile('test/files/com.amywhile.signalreborn.control', 'utf8') const control = new BinaryControl(data) expect(control.package).toEqual('com.amywhile.signalreborn') diff --git a/test/chariz.packages b/test/files/chariz.packages similarity index 100% rename from test/chariz.packages rename to test/files/chariz.packages diff --git a/test/chariz.release b/test/files/chariz.release similarity index 100% rename from test/chariz.release rename to test/files/chariz.release diff --git a/test/clang.control b/test/files/clang.control similarity index 100% rename from test/clang.control rename to test/files/clang.control diff --git a/test/com.amywhile.signalreborn.control b/test/files/com.amywhile.signalreborn.control similarity index 100% rename from test/com.amywhile.signalreborn.control rename to test/files/com.amywhile.signalreborn.control diff --git a/test/jammy.packages b/test/files/jammy.packages similarity index 100% rename from test/jammy.packages rename to test/files/jammy.packages diff --git a/test/jammy.release b/test/files/jammy.release similarity index 100% rename from test/jammy.release rename to test/files/jammy.release diff --git a/src/index.test.ts b/test/index.test.ts similarity index 61% rename from src/index.test.ts rename to test/index.test.ts index 1325cec..51f3eea 100644 --- a/src/index.test.ts +++ b/test/index.test.ts @@ -1,26 +1,26 @@ import { readFile } from 'node:fs/promises' -import { parsePackages, parseRelease } from '.' +import { parsePackages, parseRelease } from '../src' test('deprecated:release:chariz', async () => { - const data = await readFile('test/chariz.release', 'utf8') + const data = await readFile('test/files/chariz.release', 'utf8') const map = parseRelease(data) expect(map).toBeDefined() }) test('deprecated:release:jammy', async () => { - const data = await readFile('test/jammy.release', 'utf8') + const data = await readFile('test/files/jammy.release', 'utf8') const map = parseRelease(data) expect(map).toBeDefined() }) test('deprecated:packages:chariz', async () => { - const data = await readFile('test/chariz.packages', 'utf8') + const data = await readFile('test/files/chariz.packages', 'utf8') const map = parsePackages(data) expect(map.length).toBe(415) }) test('deprecated:packages:jammy', async () => { - const data = await readFile('test/jammy.packages', 'utf8') + const data = await readFile('test/files/jammy.packages', 'utf8') const map = parsePackages(data) expect(map.length).toBe(6132) }) diff --git a/src/packages.test.ts b/test/packages.test.ts similarity index 95% rename from src/packages.test.ts rename to test/packages.test.ts index 84ea7e3..93a909d 100644 --- a/src/packages.test.ts +++ b/test/packages.test.ts @@ -1,8 +1,8 @@ import { readFile } from 'node:fs/promises' -import { Packages } from '.' +import { Packages } from '../src' test('chariz:packages', async () => { - const data = await readFile('test/chariz.packages', 'utf8') + const data = await readFile('test/files/chariz.packages', 'utf8') const packages = new Packages(data) const pkg = packages[0] @@ -32,7 +32,7 @@ test('chariz:packages', async () => { }) test('jammy:packages', async () => { - const data = await readFile('test/jammy.packages', 'utf8') + const data = await readFile('test/files/jammy.packages', 'utf8') const packages = new Packages(data) const pkg = packages[0] diff --git a/src/release.test.ts b/test/release.test.ts similarity index 93% rename from src/release.test.ts rename to test/release.test.ts index f638086..d9802fa 100644 --- a/src/release.test.ts +++ b/test/release.test.ts @@ -1,8 +1,8 @@ import { readFile } from 'node:fs/promises' -import { Release } from '.' +import { Release } from '../src' test('release:chariz', async () => { - const data = await readFile('test/chariz.release', 'utf8') + const data = await readFile('test/files/chariz.release', 'utf8') const release = new Release(data) expect(release.fieldCount).toEqual(11) @@ -32,7 +32,7 @@ test('release:chariz', async () => { }) test('release:jammy', async () => { - const data = await readFile('test/jammy.release', 'utf8') + const data = await readFile('test/files/jammy.release', 'utf8') const release = new Release(data) expect(release.fieldCount).toEqual(13)