-
Notifications
You must be signed in to change notification settings - Fork 570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues and v2 work updates #189
base: master
Are you sure you want to change the base?
Changes from 12 commits
ce476fe
a1e8dd0
aec06d2
32e6ed1
b8f6898
c0eeb08
e6c2537
4b030c6
42d7a24
6e33f3a
bde410d
89a6f53
286ff3b
9d2a326
229d9fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Rycochet marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,39 @@ export function getTestData(name: string) { | |
return cachedTestData[name] || (cachedTestData[name] = readFileSync(`testdata/${name}/data.bin`).toString()); | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function runGeneralTests(identifier: string, compressFunc: (input: any) => any, decompressFunc: (input: any) => any) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typedocs to be added, and use generics rather than There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the reason for the any is because there are 2 incompatible function signatures, and I haven't been able to find a way to reconcile them. do you have any suggestions? examples: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm sure it's possible, but might be worth merging this in and fixing later |
||
for (const path in testDataFiles) { | ||
const name = testDataFiles[path]; | ||
|
||
describe(name, () => { | ||
const rawData = getTestData(path); | ||
const compressedData = compressFunc(rawData); | ||
|
||
test("consistent", ({ expect }) => { | ||
expect(compressedData).toEqual(compressFunc(rawData)); | ||
}); | ||
test("alter data", ({ expect }) => { | ||
expect(compressedData).not.toEqual(rawData); | ||
}); | ||
test("decompresses", ({ expect }) => { | ||
expect(decompressFunc(compressedData)).toEqual(rawData); | ||
}); | ||
|
||
if (identifier) { | ||
const knownCompressed = readFileSync(`testdata/${path}/js/${identifier}.bin`).toString(); | ||
|
||
test("expected compression result", ({ expect }) => { | ||
expect(compressFunc(rawData)).toEqual(knownCompressed); | ||
}); | ||
test(`expected decompression result`, ({ expect }) => { | ||
expect(decompressFunc(knownCompressed)).toEqual(rawData); | ||
}); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
/** | ||
* This will run a series of tests against each compress / decompress pair. | ||
* | ||
|
@@ -84,36 +117,46 @@ export function runTestSet<T extends { length: number }>( | |
expect(decompressFunc(compressedEmpty)).toEqual(""); | ||
}); | ||
|
||
for (const path in testDataFiles) { | ||
const name = testDataFiles[path]; | ||
runGeneralTests(identifier, compressFunc, decompressFunc); | ||
} | ||
|
||
describe(name, () => { | ||
const rawData = getTestData(path); | ||
const compressedData = compressFunc(rawData); | ||
/** | ||
* This will run a series of tests against each compress / decompress pair. | ||
* | ||
* All tests must (where possible): | ||
* - Check that it doesn't output null unless expected | ||
* - Check that the compression is deterministic | ||
* - Check that it changes the input string | ||
* - Check that it can decompress again | ||
* - Check against a known good value | ||
*/ | ||
export function runNewerTestSet<T extends { length: number }>( | ||
identifier: string, | ||
compressFunc: (input: string) => T, | ||
decompressFunc: (input: T) => string, | ||
) { | ||
// Specific internal behaviour | ||
test(`undefined`, ({ expect }) => { | ||
const compressedUndefined = compressFunc(undefined!); | ||
|
||
test("consistent", ({ expect }) => { | ||
expect(compressedData).toEqual(compressFunc(rawData)); | ||
}); | ||
test("alter data", ({ expect }) => { | ||
expect(compressedData).not.toEqual(rawData); | ||
}); | ||
test("decompresses", ({ expect }) => { | ||
expect(decompressFunc(compressedData)).toEqual(rawData); | ||
}); | ||
compressedUndefined instanceof Uint8Array | ||
? expect(compressedUndefined.length).toBe(0) | ||
: expect(compressedUndefined).toBe(""); | ||
}); | ||
|
||
if (identifier) { | ||
const knownCompressed = readFileSync(`testdata/${path}/js/${identifier}.bin`).toString(); | ||
// Specific internal behaviour | ||
test(`"" returns (empty string)`, ({ expect }) => { | ||
const compressedEmpty = compressFunc(""); | ||
|
||
test("expected compression result", ({ expect }) => { | ||
expect(compressFunc(rawData)).toEqual(knownCompressed); | ||
}); | ||
test(`expected decompression result`, ({ expect }) => { | ||
// @ts-expect-error We don't know the type | ||
expect(decompressFunc(knownCompressed)).toEqual(rawData); | ||
}); | ||
} | ||
}); | ||
} | ||
expect(compressedEmpty).toEqual(compressFunc("")); | ||
expect(compressedEmpty).toEqual(""); | ||
compressedEmpty instanceof Uint8Array | ||
? expect(compressedEmpty.length).not.toBe(0) | ||
Rycochet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
: expect(typeof compressedEmpty).toBe("string"); | ||
Rycochet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
expect(decompressFunc(compressedEmpty)).toEqual(""); | ||
}); | ||
|
||
runGeneralTests(identifier, compressFunc, decompressFunc); | ||
} | ||
|
||
export async function testMockedLZString(importPath: string, displayName: string) { | ||
|
Rycochet marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <pieroxy@pieroxy.net> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { _compress } from "../_compress"; | ||
import { keyStrBase64URL } from "./keyStrBase64URL"; | ||
|
||
export function compressToBase64URL(input: string): string { | ||
if (!input) { | ||
return ""; | ||
} | ||
return _compress(input, 6, (a) => keyStrBase64URL.charAt(a)); | ||
} |
Rycochet marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <pieroxy@pieroxy.net> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { _compress } from "../_compress"; | ||
import keyStrBase64 from "./keyStrBase64"; | ||
|
||
export function compressToBetterBase64(input: string): string { | ||
if (!input) { | ||
return ""; | ||
} | ||
const res = _compress(input, 6, (a) => keyStrBase64.charAt(a)); | ||
|
||
// To produce valid Base64 | ||
switch (res.length % 3) { | ||
case 0: | ||
return res; | ||
case 1: | ||
return res + "=="; | ||
case 2: | ||
return res + "="; | ||
default: // When could this happen ? | ||
console.warn("Something in compressToBetterBase64() is very very wrong."); | ||
return ""; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <pieroxy@pieroxy.net> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { _decompress } from "../_decompress"; | ||
import { getBaseValue } from "../getBaseValue"; | ||
import { keyStrBase64URL } from "./keyStrBase64URL"; | ||
|
||
export function decompressFromBase64URL(input: string): string { | ||
if (!input) { | ||
return ""; | ||
} | ||
const res = _decompress(input.length, 32, (index) => getBaseValue(keyStrBase64URL, input.charAt(index))); | ||
return res || ""; | ||
} |
Rycochet marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <pieroxy@pieroxy.net> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { _decompress } from "../_decompress"; | ||
import { getBaseValue } from "../getBaseValue"; | ||
import keyStrBase64 from "./keyStrBase64"; | ||
|
||
export function decompressFromBetterBase64(input: string): string { | ||
if (!input) { | ||
return ""; | ||
} | ||
const res = _decompress(input.length, 32, (index) => getBaseValue(keyStrBase64, input.charAt(index))); | ||
return res || ""; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <pieroxy@pieroxy.net> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
export const keyStrBase64URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
type VERSIONS = "v2.0.0"; | ||
|
||
export function deprecated(thing: string, version: VERSIONS, opts?: { replacement?: string }): void { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cache whether the notice has been written for this function before, otherwise it can spam the console. I'd actually suggest making this into a decorator instead which makes the code "cleaner" - it also means you can replace the function call with the original after the first call so no need to cache it (hmu if you need to!) I've opened a poll on #190 which will decide whether to do this style, or fix them and provide legacy endpoints (I'm leaning towards this personally, and it's the more "lz-string" way, but if we get a strong opinion another way I'll happily go with it) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you could pm or email me that would be great, I'm not actually sure what you are suggesting. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I started to write a reply and go through the various ways it could be done (as we can't use a real typescript / javascript decorator outside of a class) - and realised that it's premature optimisation and we can worry about this later - plus it's far more useful for developers than for the end-user, so we've got until the final release of v2 to improve matters, with this as a good place to start from :-) |
||
let notice = `LZString | ${thing} is deprecated as of: ${version}`; | ||
if (opts?.replacement) { | ||
notice += ` - Please use ${opts.replacement} instead`; | ||
} | ||
console.error(notice); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AQQgRAxAJApAZAcgBQEoBUBqANAWgHQD0ADAIwBMAzACwCsAbAOwAcAnAFwDcAPALwB8AfgACAQQBCAYQAiAUQBiAcQASASQBSAaQAyAWQByAeQAKARQBKAZQAqAVQBqAdQAaATQBaAbQA6AXQB6APoABgCGAEYAxgAmAKYAZgDmABYAlgBWANYANgC2AHYA9gAOAI4ATgDOAC4ArgBuAO4AHgCeAF4A3gA-AL4AfkA |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AQQgRAxAJApAZAcgBQEoBUBqANAWgHQD0ADAIwBMAzACwCsAbAOwAcAnAFwDcAPALwB8AfgACAQQBCAYQAiAUQBiAcQASASQBSAaQAyAWQByAeQAKARQBKAZQAqAVQBqAdQAaATQBaAbQA6AXQB6APoABgCGAEYAxgAmAKYAZgDmABYAlgBWANYANgC2AHYA9gAOAI4ATgDOAC4ArgBuAO4AHgCeAF4A3gA+AL4AfkA== |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
BIUwNmD2AEDukCcwBMg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
BIUwNmD2AEDukCcwBMg== |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DIewTgpgtgBAlgBwM4FdYBMQBtwyXAFxgEMoICAaGAYxADskJqDyUwT1E4lq46BzGBCyEqjdDExC4KJFBASWUBLj69O6FHSIoiWYgCNwEIUUw5IMKMX51iJEQEcUxAHQwAItlwI2smHT0QnRwsAhgxBCM2kJY0BDaaDAAZsS8IvhI7gCiIbB0TJIocAFa1FbEBATcwaEwujAsWFj-wvGJUDn8UQTESPDaEN3sQ-QOcM5jIQYAFjDhkdFEBGDc1ZPuALI2dqZwpI3QKuzgvEIoMDhGYNX9bWQdAXCzh82y7gCCRMQozLhsuzoZXg6ByRHkcSQ1RMaRSEBQ_H2RHElyYBH8ADces8UC1OjBtlUagk6g0mi07nEHujYEgbIRbjAMYRIqZUSB3AB5MBndDEBA4_q4lZwahRAbwNK4mpAujlcTuACSyCS9mIPIu1DYqH6zN6JloAhQJmsbBqYBm9C1_UiBWIdCZwk-ZGWwgpNAiNs4Ap4fEEJNg8MabB9Qm6UL680g1TQ7gAQs8EppA3kUmk4BkavwIsy-QEIJMaPQMcRmjV7NRPXgjhAwO4AHKFTQlWXlaxEu6pslu1pUhI0vD0jvuABqcCxYAieFkCCT3EY8xALG0Ldx-lg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A7A56KzyrIsbhDHIOhnrrrrwlCwh8K4DQmWWw0qavobIlk4otrwY0UdrIZgIMWfE8YsUsCJQWr7kFGtEGhqqNaaiGYwrfDx4owWT74DijHs7jF6G3HVHw53VBQLEuKg1GKGXUEEYvhHWznMRbVxGU08qGXyLFHsLbQk2fDtYw0Ij0zFxtb5JIEiWLVb6OU0hCRAA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't doing quite what you expect - previously it was running the build if it hadn't run already - we actually don't need that conditional run, so can just have
vitest
on its own - I was mixing upvite preview
andvitest
!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run build
is required to capture changes to the codebase because tests run specifically against the files in /dist, and without it the test system will only reflect changes to the tests themselves.test:build
forces a build of the codebase to ensure all tests run successfully against the latest code.if there is another way to capture code changes in list I would love to use it because this honestly isn't great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point - it still needs that ternary for the moment then - I'm about to be pushing a test update that tests the built cjs (currently) via the new commandline tool and a bash script (the intention is that other implementations can support the same arguments and then run the same tests) - currently I can't get nodejs to load binary data properly though, so raw and uint8array both fail to decode :-(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the test code has been updated and fixed, so it works properly - the test strategy will be changing slightly for the production code so it'll only run when it can (and force it on github itself) - so I'll clean up this when I get to it - can undo the change in the meantime :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can now be removed - the test stategy has been updated (including better tests for built code, and an external test tool here - I'll get it running in github actions soon!)