Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from steve-bate/base-url
Added support for base URL setting.
- Loading branch information
Showing
6 changed files
with
92 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* global describe, it, expect */ | ||
|
||
const ActivitypubExpress = require('../../index') | ||
|
||
const routes = { | ||
actor: '/u/:actor', | ||
object: '/o/:id', | ||
activity: '/s/:id', | ||
inbox: '/inbox/:actor', | ||
outbox: '/outbox/:actor', | ||
followers: '/followers/:actor', | ||
following: '/following/:actor', | ||
liked: '/liked/:actor', | ||
shares: '/s/:id/shares', | ||
likes: '/s/:id/likes', | ||
collections: '/u/:actor/c/:id', | ||
blocked: '/u/:actor/blocked', | ||
rejections: '/u/:actor/rejections', | ||
rejected: '/u/:actor/rejected', | ||
nodeinfo: '/nodeinfo' | ||
} | ||
|
||
describe('apex', function () { | ||
it('should use base URL if set and no domain', function () { | ||
const apex = ActivitypubExpress({ | ||
baseUrl: 'https://localhost', | ||
routes | ||
}) | ||
expect(apex.domain).toBe('localhost') | ||
expect(apex.baseUrl).toBe('https://localhost') | ||
}) | ||
|
||
it('should use domain if set and no base URL', function () { | ||
const apex = ActivitypubExpress({ | ||
domain: 'somedomain:4321', | ||
routes | ||
}) | ||
expect(apex.domain).toBe('somedomain:4321') | ||
expect(apex.baseUrl).toBe('https://somedomain:4321') | ||
}) | ||
|
||
it('should prefer baseURL if domain is also set', function () { | ||
const apex = ActivitypubExpress({ | ||
domain: 'somedomain', | ||
baseUrl: 'https://someotherdomain:9876', | ||
routes | ||
}) | ||
expect(apex.domain).toBe('someotherdomain:9876') | ||
expect(apex.baseUrl).toBe('https://someotherdomain:9876') | ||
}) | ||
}) |