Skip to content

Commit

Permalink
tests updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Hayes committed Oct 3, 2020
1 parent ff629e4 commit 6f91523
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hayes0724/web-font-converter",
"version": "1.0.4",
"version": "1.0.5",
"main": "src/index.js",
"license": "MIT",
"author": "eric hayes <eric@hayesmarketing.io>",
Expand Down
32 changes: 11 additions & 21 deletions tests/api-convert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ const createOutputDirectory = () => {
}
}

beforeAll(() => {
createOutputDirectory()
})

afterEach(() => {
fsExtra.emptyDirSync('./tests/output/')
});

describe('TTF input font tests', () => {
beforeAll(() => {
createOutputDirectory()
})
afterAll(() => {
fsExtra.emptyDirSync('./tests/output/')
});
test('convert ttf to woff', () => {
convertFont(`${fileIn}.ttf`, `${fileOut}.woff`)
const size = fs.statSync(`${fileOut}.woff`).size
Expand All @@ -32,12 +34,6 @@ describe('TTF input font tests', () => {
})

describe('OTF input font tests', () => {
beforeAll(() => {
createOutputDirectory()
})
afterEach(() => {
fsExtra.emptyDirSync('./tests/output/')
});
test('convert otf to woff', () => {
convertFont(`${fileIn}.otf`, `${fileOut}.woff`)
const size = fs.statSync(`${fileOut}.woff`).size
Expand All @@ -47,8 +43,8 @@ describe('OTF input font tests', () => {
test('convert otf to woff2', () => {
convertFont(`${fileIn}.otf`, `${fileOut}.woff2`)
const size = fs.statSync(`${fileOut}.woff2`).size
expect(size).toBeGreaterThanOrEqual(35050);
expect(size).toBeLessThanOrEqual(35150);
expect(size).toBeGreaterThanOrEqual(35000);
expect(size).toBeLessThanOrEqual(35300);
});

test('convert otf to ttf', () => {
Expand All @@ -65,12 +61,6 @@ describe('OTF input font tests', () => {
})

describe('SVG input font tests', () => {
beforeAll(() => {
createOutputDirectory()
})
afterEach(() => {
fsExtra.emptyDirSync('./tests/output/')
});
test('convert svg to ttf', () => {
convertFont(`${fileIn}.svg`, `${fileOut}.ttf`)
const size = fs.statSync(`${fileOut}.ttf`).size
Expand All @@ -87,6 +77,6 @@ describe('SVG input font tests', () => {
convertFont(`${fileIn}.svg`, `${fileOut}.woff2`)
const size = fs.statSync(`${fileOut}.woff2`).size
expect(size).toBeGreaterThanOrEqual(35000);
expect(size).toBeLessThanOrEqual(35200);
expect(size).toBeLessThanOrEqual(35300);
});
})
6 changes: 3 additions & 3 deletions tests/api-fonts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ describe('OTF input font tests', () => {
test('convert otf to woff2', () => {
fonts.otf.convert.woff2(`${fileIn}.otf`, `${fileOut}.woff2`)
const size = fs.statSync(`${fileOut}.woff2`).size
expect(size).toBeGreaterThanOrEqual(35050);
expect(size).toBeLessThanOrEqual(35150);
expect(size).toBeGreaterThanOrEqual(35000);
expect(size).toBeLessThanOrEqual(35300);
});

test('convert otf to ttf', () => {
Expand Down Expand Up @@ -77,6 +77,6 @@ describe('SVG input font tests', () => {
fonts.svg.convert.woff2(`${fileIn}.svg`, `${fileOut}.woff2`)
const size = fs.statSync(`${fileOut}.woff2`).size
expect(size).toBeGreaterThanOrEqual(35000);
expect(size).toBeLessThanOrEqual(35200);
expect(size).toBeLessThanOrEqual(35300);
});
})

0 comments on commit 6f91523

Please sign in to comment.