diff --git a/src/index.test.ts b/src/index.test.ts index de3cb0d..01f23a2 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -4,14 +4,14 @@ import { TOC, parse } from './' describe('parse TOC', () => { describe('empty file', () => { it('returns empty TOC object', async () => { - const file = await open(__dirname + '/../test/fixtures/empty.toc', 'r'); + const file = await open(__dirname + '/../test/empty.toc', 'r'); const toc = await parse(file) expect(toc).toEqual(new TOC()) }) }) describe('basic file', () => { it('returns basic TOC object', async () => { - const file = await open(__dirname + '/../test/fixtures/basic.toc', 'r'); + const file = await open(__dirname + '/../test/basic.toc', 'r'); const toc = await parse(file) expect(toc).toEqual({ AddonCompartmentFunc: null, @@ -44,7 +44,7 @@ describe('parse TOC', () => { }) describe('complete file', () => { it('returns complete TOC object', async () => { - const file = await open(__dirname + '/../test/fixtures/complete.toc', 'r'); + const file = await open(__dirname + '/../test/complete.toc', 'r'); const toc = await parse(file) expect(toc).toEqual({ "AddonCompartmentFunc": "Func1", @@ -129,7 +129,7 @@ describe('parse TOC', () => { }) describe('Recount file', () => { it('returns Recount TOC object', async () => { - const file = await open(__dirname + '/../test/fixtures/Recount.toc', 'r'); + const file = await open(__dirname + '/../test/Recount.toc', 'r'); const toc = await parse(file) expect(toc).toEqual({ AddonCompartmentFunc: null, @@ -213,11 +213,11 @@ describe('parse TOC', () => { describe('strict checks', () => { describe('for lines longer then 1024 characters', () => { it('fails with strict = true', async () => { - const file = await open(__dirname + '/../test/fixtures/strict.1024.toc', 'r'); + const file = await open(__dirname + '/../test/strict.1024.toc', 'r'); expect(parse(file)).rejects.toThrowError('Line is longer than TOC_LINE_MAX_LENGTH characters, WoW will truncate!') }) it('succeeds with strict = false', async () => { - const file = await open(__dirname + '/../test/fixtures/strict.1024.toc', 'r'); + const file = await open(__dirname + '/../test/strict.1024.toc', 'r'); const toc = await parse(file, false) expect(toc).toEqual({ AddonCompartmentFunc: null, @@ -251,11 +251,11 @@ describe('parse TOC', () => { }) describe('for double colon', () => { it('fails with strict = true', async () => { - const file = await open(__dirname + '/../test/fixtures/strict.doublecolon.toc', 'r'); + const file = await open(__dirname + '/../test/strict.doublecolon.toc', 'r'); expect(parse(file)).rejects.toThrowError('Tag could not be parsed: X-Invalid-Tag1,, Weird Tag1') }) it('succeeds with strict = false', async () => { - const file = await open(__dirname + '/../test/fixtures/strict.doublecolon.toc', 'r'); + const file = await open(__dirname + '/../test/strict.doublecolon.toc', 'r'); const toc = await parse(file, false) expect(toc).toEqual({ AddonCompartmentFunc: null, @@ -288,11 +288,11 @@ describe('parse TOC', () => { }) describe('for duplicate tag', () => { it('fails with strict = true', async () => { - const file = await open(__dirname + '/../test/fixtures/strict.duplicate.toc', 'r'); + const file = await open(__dirname + '/../test/strict.duplicate.toc', 'r'); expect(parse(file)).rejects.toThrowError('Duplicate value: X-Duplicate-Tag') }) it('succeeds with strict = false', async () => { - const file = await open(__dirname + '/../test/fixtures/strict.duplicate.toc', 'r'); + const file = await open(__dirname + '/../test/strict.duplicate.toc', 'r'); const toc = await parse(file, false) expect(toc).toEqual({ AddonCompartmentFunc: null, @@ -326,11 +326,11 @@ describe('for duplicate tag', () => { }) describe('for unknown notes locale', () => { it('fails with strict = true', async () => { - const file = await open(__dirname + '/../test/fixtures/strict.locale.notes.toc', 'r'); + const file = await open(__dirname + '/../test/strict.locale.notes.toc', 'r'); expect(parse(file)).rejects.toThrowError('Locale not found: noNO') }) it('succeeds with strict = false', async () => { - const file = await open(__dirname + '/../test/fixtures/strict.locale.notes.toc', 'r'); + const file = await open(__dirname + '/../test/strict.locale.notes.toc', 'r'); const toc = await parse(file, false) expect(toc).toEqual({ AddonCompartmentFunc: null, @@ -363,11 +363,11 @@ describe('for unknown notes locale', () => { }) describe('for unknown title locale', () => { it('fails with strict = true', async () => { - const file = await open(__dirname + '/../test/fixtures/strict.locale.title.toc', 'r'); + const file = await open(__dirname + '/../test/strict.locale.title.toc', 'r'); expect(parse(file)).rejects.toThrowError('Locale not found: noNO') }) it('succeeds with strict = false', async () => { - const file = await open(__dirname + '/../test/fixtures/strict.locale.title.toc', 'r'); + const file = await open(__dirname + '/../test/strict.locale.title.toc', 'r'); const toc = await parse(file, false) expect(toc).toEqual({ AddonCompartmentFunc: null, @@ -400,11 +400,11 @@ describe('for unknown title locale', () => { }) describe('for unknown tag', () => { it('fails with strict = true', async () => { - const file = await open(__dirname + '/../test/fixtures/strict.unknowntag.toc', 'r'); + const file = await open(__dirname + '/../test/strict.unknowntag.toc', 'r'); expect(parse(file)).rejects.toThrowError('Unknown Tag name: SomeTag') }) it('succeeds with strict = false', async () => { - const file = await open(__dirname + '/../test/fixtures/strict.unknowntag.toc', 'r'); + const file = await open(__dirname + '/../test/strict.unknowntag.toc', 'r'); const toc = await parse(file, false) expect(toc).toEqual({ AddonCompartmentFunc: null, diff --git a/test/fixtures/Recount.toc b/test/Recount.toc similarity index 100% rename from test/fixtures/Recount.toc rename to test/Recount.toc diff --git a/test/fixtures/basic.toc b/test/basic.toc similarity index 100% rename from test/fixtures/basic.toc rename to test/basic.toc diff --git a/test/fixtures/complete.toc b/test/complete.toc similarity index 100% rename from test/fixtures/complete.toc rename to test/complete.toc diff --git a/test/fixtures/empty.toc b/test/empty.toc similarity index 100% rename from test/fixtures/empty.toc rename to test/empty.toc diff --git a/test/fixtures/strict.1024.toc b/test/strict.1024.toc similarity index 100% rename from test/fixtures/strict.1024.toc rename to test/strict.1024.toc diff --git a/test/fixtures/strict.doublecolon.toc b/test/strict.doublecolon.toc similarity index 100% rename from test/fixtures/strict.doublecolon.toc rename to test/strict.doublecolon.toc diff --git a/test/fixtures/strict.duplicate.toc b/test/strict.duplicate.toc similarity index 100% rename from test/fixtures/strict.duplicate.toc rename to test/strict.duplicate.toc diff --git a/test/fixtures/strict.locale.notes.toc b/test/strict.locale.notes.toc similarity index 100% rename from test/fixtures/strict.locale.notes.toc rename to test/strict.locale.notes.toc diff --git a/test/fixtures/strict.locale.title.toc b/test/strict.locale.title.toc similarity index 100% rename from test/fixtures/strict.locale.title.toc rename to test/strict.locale.title.toc diff --git a/test/fixtures/strict.unknowntag.toc b/test/strict.unknowntag.toc similarity index 100% rename from test/fixtures/strict.unknowntag.toc rename to test/strict.unknowntag.toc