mirror of
https://github.com/wassname/talk.git
synced 2026-09-11 12:51:33 +08:00
[next] Tasks (#1777)
* feat: initial support for synced tenants * fix: cleanup * fix: logger now respects logging level * fix: cache now ignores updates issued from itself * feat: print subscriber count * feat: initial moderation + validation for new comments * fix: added Promiseable type * feat: initial actions impl * feat: more moderation phases * fix: handle settings inheritence * fix: moved settings into new file * fix: defaults and documentation * fix: replace merge with object spread * feat: added integration with akismet * fix: support tenant cache for oidc strategy * fix: fixed compile * fix: import ordering * feat: added bull for queue support * feat: support for scraping * fix: fixes for scraper - Implemented simple metascraper replacement (to resolve security advisory warning) - Implemented simle dotize replacement (to resolve not working version that couldn't handle date objects) - Plugged in asset scraping to asset creation process * fix: handles array values * feat: added initial scraper implementation * feat: seperate queues but share config * fix: simplified auth data access * feat: moved more settings into the graph * feat: improved mailer design * fix: fixed issue with dotize * fix: fixed some issues with adapter * fix: queue cleanup * feat: added organizationName to Tenant * feat: email rendering * review: support es6 imports * fix: restore old ci step * fix: adjusted logging messages
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
import { dotize } from "talk-common/utils/dotize";
|
||||
|
||||
it("converts nested properties", () => {
|
||||
const input = {
|
||||
a: "property",
|
||||
can: { be: "nested", really: { deeply: "sometimes" } },
|
||||
};
|
||||
const output = dotize(input);
|
||||
|
||||
expect(output).toEqual({
|
||||
a: "property",
|
||||
"can.be": "nested",
|
||||
"can.really.deeply": "sometimes",
|
||||
});
|
||||
});
|
||||
|
||||
it("converts properties with dates", () => {
|
||||
const now = new Date();
|
||||
const input = { a: now, can: { be: now } };
|
||||
const output = dotize(input);
|
||||
|
||||
expect(output).toEqual({
|
||||
a: now,
|
||||
"can.be": now,
|
||||
});
|
||||
});
|
||||
|
||||
it("converts array properties when enabled", () => {
|
||||
const input = {
|
||||
a: [
|
||||
{ property: "with", an: "array" },
|
||||
{ value: [{ sometimes: "nested" }] },
|
||||
],
|
||||
other: { times: "not" },
|
||||
};
|
||||
const output = dotize(input);
|
||||
|
||||
expect(output).toEqual({
|
||||
"a[0].property": "with",
|
||||
"a[0].an": "array",
|
||||
"a[1].value[0].sometimes": "nested",
|
||||
"other.times": "not",
|
||||
});
|
||||
});
|
||||
|
||||
it("does not converts array properties when disabled", () => {
|
||||
const input = {
|
||||
a: [
|
||||
{ property: "with", an: "array" },
|
||||
{ value: [{ sometimes: "nested" }] },
|
||||
],
|
||||
other: { times: "not" },
|
||||
};
|
||||
const output = dotize(input, { ignoreArrays: true });
|
||||
|
||||
expect(output).toEqual({
|
||||
"other.times": "not",
|
||||
});
|
||||
});
|
||||
|
||||
it("does convert array properties properly", () => {
|
||||
expect(
|
||||
dotize({ wordlist: { banned: ["banned"] } }, { embedArrays: true })
|
||||
).toEqual({
|
||||
"wordlist.banned": ["banned"],
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user