mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-05-16 12:33:04 -04:00
Enable Biome's `organizeImports` with groups matching the original ESLint `import/order` configuration: 1. **Node builtins** (`node:fs`, `path`, etc.) 2. *(blank line)* 3. **Third-party packages** (`express`, `@sentry/node`, etc.) 4. *(blank line)* 5. **Local/relative imports** (`../foo.js`, `./bar.js`, aliases) This resolves the inconsistency where Biome wasn't enforcing import grouping, meaning new files would lose the blank-line separation that the old ESLint config enforced. ### Impact - **354 files** updated out of 738 checked (~48%) - **+188 / -240 lines** (net -52) — almost entirely single blank line additions/removals between import groups - No import reordering; purely group separator consistency Fixes #7373 🤖 Generated by LLM (Claude, via OpenClaw)
98 lines
3.4 KiB
TypeScript
98 lines
3.4 KiB
TypeScript
import {describe, expect, it} from 'vitest';
|
|
|
|
import * as urlSerialization from '../shared/url-serialization.js';
|
|
|
|
describe('URL Serialization', () => {
|
|
it('should serialise and deserialise a simple state', () => {
|
|
const state = {
|
|
content: [
|
|
{
|
|
type: 'row',
|
|
content: [
|
|
{
|
|
type: 'component',
|
|
componentName: 'codeEditor',
|
|
componentState: {
|
|
id: 1,
|
|
lang: 'c++',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
};
|
|
|
|
const serialized = urlSerialization.serialiseState(state);
|
|
expect(serialized).toBeTruthy();
|
|
expect(typeof serialized).toBe('string');
|
|
|
|
const deserialized = urlSerialization.deserialiseState(serialized);
|
|
expect(deserialized).toBeTruthy();
|
|
expect(deserialized.version).toBe(4);
|
|
expect(deserialized.content).toEqual(state.content);
|
|
});
|
|
|
|
it('should compress large states when beneficial', () => {
|
|
const state = {
|
|
content: [
|
|
{
|
|
type: 'row',
|
|
content: Array.from({length: 50}, (_, i) => ({
|
|
type: 'component',
|
|
componentName: 'codeEditor',
|
|
componentState: {
|
|
id: i,
|
|
lang: 'c++',
|
|
source: 'int main() { return 0; }',
|
|
},
|
|
})),
|
|
},
|
|
],
|
|
};
|
|
|
|
const serialized = urlSerialization.serialiseState(state);
|
|
// Compressed format contains {z: ...} which rison-encodes to contain 'z:'
|
|
// This test just verifies the state serializes successfully
|
|
expect(serialized).toBeTruthy();
|
|
expect(typeof serialized).toBe('string');
|
|
expect(serialized.length).toBeGreaterThan(0);
|
|
|
|
// Verify it can be deserialized
|
|
const deserialized = urlSerialization.deserialiseState(serialized);
|
|
expect(deserialized.content).toHaveLength(1);
|
|
expect(deserialized.content[0].content).toHaveLength(50);
|
|
});
|
|
|
|
it('should handle round-trip encoding correctly', () => {
|
|
const state = {
|
|
content: [
|
|
{
|
|
type: 'column',
|
|
content: [
|
|
{
|
|
type: 'stack',
|
|
content: [
|
|
{
|
|
type: 'component',
|
|
componentName: 'compiler',
|
|
componentState: {
|
|
id: 1,
|
|
compiler: 'g132',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
};
|
|
|
|
const hash1 = urlSerialization.serialiseState(state);
|
|
const restored = urlSerialization.deserialiseState(hash1);
|
|
const hash2 = urlSerialization.serialiseState(restored);
|
|
|
|
// Round-trip should produce identical hash
|
|
expect(hash2).toBe(hash1);
|
|
});
|
|
});
|