refactor: use standard prettier formatting

This commit is contained in:
2024-04-06 13:15:35 +02:00
parent 86ec8651b6
commit 854ab6d3be
106 changed files with 2703 additions and 2046 deletions

View File

@@ -1,4 +1,4 @@
import {describe, it, expect} from "vitest"
import { describe, it, expect } from "vitest";
import {
deserializeActions,
parseChordActions,
@@ -6,43 +6,55 @@ import {
serializeActions,
stringifyChordActions,
stringifyPhrase,
} from "./chord"
} from "./chord";
describe("chords", function () {
describe("actions", function () {
it("should serialize actions", function () {
expect(serializeActions([32, 51]).toString(16)).toEqual(0xcc200000000000000000000000000n.toString(16))
})
expect(serializeActions([32, 51]).toString(16)).toEqual(
0xcc200000000000000000000000000n.toString(16),
);
});
it("should deserialize actions", function () {
expect(deserializeActions(0xcc200000000000000000000000000n)).toEqual([32, 51])
})
expect(deserializeActions(0xcc200000000000000000000000000n)).toEqual([
32, 51,
]);
});
for (let i = 0; i < 12; i++) {
it(`should serialize back-forth ${i} actions`, function () {
const actions = Array.from({length: i}).map((_, i) => i + 1)
expect(deserializeActions(serializeActions(actions))).toEqual(actions)
})
const actions = Array.from({ length: i }).map((_, i) => i + 1);
expect(deserializeActions(serializeActions(actions))).toEqual(actions);
});
}
})
});
describe("phrase", function () {
it("should stringify", function () {
expect(stringifyPhrase([0x20, 0x68, 0x72, 0xd4, 0x65, 0x1fff])).toEqual("206872D4651FFF")
})
expect(stringifyPhrase([0x20, 0x68, 0x72, 0xd4, 0x65, 0x1fff])).toEqual(
"206872D4651FFF",
);
});
it("should parse", function () {
expect(parsePhrase("206872D4651FFF")).toEqual([0x20, 0x68, 0x72, 0xd4, 0x65, 0x1fff])
})
})
expect(parsePhrase("206872D4651FFF")).toEqual([
0x20, 0x68, 0x72, 0xd4, 0x65, 0x1fff,
]);
});
});
describe("chord actions", function () {
it("should stringify", function () {
expect(stringifyChordActions([32, 51])).toEqual("000CC200000000000000000000000000")
})
expect(stringifyChordActions([32, 51])).toEqual(
"000CC200000000000000000000000000",
);
});
it("should parse", function () {
expect(parseChordActions("000CC200000000000000000000000000")).toEqual([32, 51])
})
})
})
expect(parseChordActions("000CC200000000000000000000000000")).toEqual([
32, 51,
]);
});
});
});