wip
This commit is contained in:
parent
139265023a
commit
8dca0641f5
|
@ -204,22 +204,25 @@ export const USERNAME_REGEXP = /^[\w\d]{3,12}$/;
|
|||
* @see {@link W3ID_SECURITY_CONTEXT}
|
||||
* @see {@link SCHEMA_ORG_CONTEXT}
|
||||
*/
|
||||
export const DEFAULT_ACTOR_CONTEXT = {
|
||||
'@vocab': ACTIVITYSTREAMS_CONTEXT,
|
||||
sec: W3ID_SECURITY_CONTEXT,
|
||||
schema: SCHEMA_ORG_CONTEXT,
|
||||
};
|
||||
export const DEFAULT_ACTOR_CONTEXT = [
|
||||
W3ID_SECURITY_CONTEXT,
|
||||
ACTIVITYSTREAMS_CONTEXT,
|
||||
{
|
||||
schema: SCHEMA_ORG_CONTEXT,
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* The default JSON-LD context for ActivityPub Actors, with instances of URL in
|
||||
* place of strings.
|
||||
*/
|
||||
*
|
||||
export const DEFAULT_ACTOR_CONTEXT_AS_URLS = Object.fromEntries(
|
||||
Object.entries(DEFAULT_ACTOR_CONTEXT).map(([key, value]) => [
|
||||
key,
|
||||
new URL(value),
|
||||
]),
|
||||
);
|
||||
*/
|
||||
|
||||
/**
|
||||
* Express-style route parameters.
|
||||
|
|
|
@ -3,7 +3,7 @@ import 'jasmine';
|
|||
import { compactJsonObject } from '../src/compactJsonObject';
|
||||
|
||||
describe('compactJsonObject', () => {
|
||||
it('should compact a JSON object', async () => {
|
||||
it('should maintain JSON object', async () => {
|
||||
const compacted = await compactJsonObject({
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: 'https://example.com',
|
||||
|
@ -18,4 +18,27 @@ describe('compactJsonObject', () => {
|
|||
name: 'Example',
|
||||
});
|
||||
});
|
||||
|
||||
it('should compact plain JSON object', async () => {
|
||||
const compacted = await compactJsonObject({
|
||||
id: 'https://example.com',
|
||||
type: 'Person',
|
||||
name: 'Example',
|
||||
image: {
|
||||
type: 'Image',
|
||||
url: 'https://example.com/image.png',
|
||||
},
|
||||
});
|
||||
|
||||
expect(compacted).toEqual({
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: 'https://example.com',
|
||||
type: 'Person',
|
||||
name: 'Example',
|
||||
image: {
|
||||
type: 'Image',
|
||||
url: 'https://example.com/image.png',
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue