Switch to prettier default config of using double quotes

This commit is contained in:
Michael Smith
2023-05-30 10:42:26 +02:00
parent 24875d989b
commit bd68eb6940
5 changed files with 60 additions and 60 deletions

View File

@@ -25,46 +25,46 @@
*/
import { expect, test } from 'vitest';
import { expect, test } from "vitest";
import PBM from '../src/pbm.js';
import PBM from "../src/pbm.js";
const fs = require('fs');
const fs = require("fs");
test('Successfully parse a PBM file', () => {
const data = fs.readFileSync('./tests/fixtures/VALID.LBM');
test("Successfully parse a PBM file", () => {
const data = fs.readFileSync("./tests/fixtures/VALID.LBM");
expect(() => {
new PBM(data.buffer);
}).not.toThrowError();
});
test('Fail to parse a PBM file with an invalid chunk id', () => {
const data = fs.readFileSync('./tests/fixtures/INVALID_CHUNK_ID.LBM');
test("Fail to parse a PBM file with an invalid chunk id", () => {
const data = fs.readFileSync("./tests/fixtures/INVALID_CHUNK_ID.LBM");
expect(() => {
new PBM(data.buffer);
}).toThrowError(/^Invalid chunkId: "FARM" at byte 12. Expected "FORM".$/);
});
test('Fail to parse a PBM file with an invalid chunk length', () => {
const data = fs.readFileSync('./tests/fixtures/INVALID_CHUNK_LENGTH.LBM');
test("Fail to parse a PBM file with an invalid chunk length", () => {
const data = fs.readFileSync("./tests/fixtures/INVALID_CHUNK_LENGTH.LBM");
expect(() => {
new PBM(data.buffer);
}).toThrowError(/^Invalid chunk length: 7070 bytes. Expected 7012 bytes.$/);
});
test('Fail to parse an IFF file that is not a PBM file', () => {
const data = fs.readFileSync('./tests/fixtures/SEASCAPE.LBM');
test("Fail to parse an IFF file that is not a PBM file", () => {
const data = fs.readFileSync("./tests/fixtures/SEASCAPE.LBM");
expect(() => {
new PBM(data.buffer);
}).toThrowError(/^Invalid formatId: "ILBM". Expected "PBM ".$/);
});
test('Parse a PBM bitmap header', () => {
const data = fs.readFileSync('./tests/fixtures/VALID.LBM');
test("Parse a PBM bitmap header", () => {
const data = fs.readFileSync("./tests/fixtures/VALID.LBM");
const image = new PBM(data.buffer);
expect(image.width).toStrictEqual(640);
@@ -82,23 +82,23 @@ test('Parse a PBM bitmap header', () => {
expect(image.pageHeight).toStrictEqual(480);
});
test('Parse PBM palette information', () => {
const data = fs.readFileSync('./tests/fixtures/VALID.LBM');
test("Parse PBM palette information", () => {
const data = fs.readFileSync("./tests/fixtures/VALID.LBM");
const image = new PBM(data.buffer);
expect(image.palette.length).toStrictEqual(256);
expect(image.palette[10]).toStrictEqual([87, 255, 87]);
});
test('Parse PBM color cycling information', () => {
const data = fs.readFileSync('./tests/fixtures/VALID.LBM');
test("Parse PBM color cycling information", () => {
const data = fs.readFileSync("./tests/fixtures/VALID.LBM");
const image = new PBM(data.buffer);
expect(image.cyclingRanges.length).toStrictEqual(16);
});
test('Parse PBM thumbnail', () => {
const data = fs.readFileSync('./tests/fixtures/VALID.LBM');
test("Parse PBM thumbnail", () => {
const data = fs.readFileSync("./tests/fixtures/VALID.LBM");
const image = new PBM(data.buffer);
expect(image.thumbnail.width).toStrictEqual(80);
@@ -106,8 +106,8 @@ test('Parse PBM thumbnail', () => {
expect(image.thumbnail.size).toStrictEqual(4800);
});
test('Decode PBM thumbnail pixel data', () => {
const data = fs.readFileSync('./tests/fixtures/VALID.LBM');
test("Decode PBM thumbnail pixel data", () => {
const data = fs.readFileSync("./tests/fixtures/VALID.LBM");
const image = new PBM(data.buffer);
expect(image.thumbnail.pixelData.length).toStrictEqual(4800);
@@ -116,8 +116,8 @@ test('Decode PBM thumbnail pixel data', () => {
expect(image.palette[14]).toStrictEqual([255, 255, 87]);
});
test('Decode PBM image pixel data', () => {
const data = fs.readFileSync('./tests/fixtures/VALID.LBM');
test("Decode PBM image pixel data", () => {
const data = fs.readFileSync("./tests/fixtures/VALID.LBM");
const image = new PBM(data.buffer);
expect(image.pixelData.length).toStrictEqual(307_200);