Test: use Bypass for remote context test (#8)
This commit is contained in:
parent
3205dbef2a
commit
8781470e2e
2 changed files with 51 additions and 1 deletions
41
test/fixtures/litepub-0.1.jsonld
vendored
Normal file
41
test/fixtures/litepub-0.1.jsonld
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/v1",
|
||||
{
|
||||
"Emoji": "toot:Emoji",
|
||||
"Hashtag": "as:Hashtag",
|
||||
"PropertyValue": "schema:PropertyValue",
|
||||
"atomUri": "ostatus:atomUri",
|
||||
"conversation": {
|
||||
"@id": "ostatus:conversation",
|
||||
"@type": "@id"
|
||||
},
|
||||
"discoverable": "toot:discoverable",
|
||||
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
||||
"capabilities": "litepub:capabilities",
|
||||
"ostatus": "http://ostatus.org#",
|
||||
"schema": "http://schema.org#",
|
||||
"toot": "http://joinmastodon.org/ns#",
|
||||
"value": "schema:value",
|
||||
"sensitive": "as:sensitive",
|
||||
"litepub": "http://litepub.social/ns#",
|
||||
"invisible": "litepub:invisible",
|
||||
"directMessage": "litepub:directMessage",
|
||||
"listMessage": {
|
||||
"@id": "litepub:listMessage",
|
||||
"@type": "@id"
|
||||
},
|
||||
"oauthRegistrationEndpoint": {
|
||||
"@id": "litepub:oauthRegistrationEndpoint",
|
||||
"@type": "@id"
|
||||
},
|
||||
"EmojiReact": "litepub:EmojiReact",
|
||||
"ChatMessage": "litepub:ChatMessage",
|
||||
"alsoKnownAs": {
|
||||
"@id": "as:alsoKnownAs",
|
||||
"@type": "@id"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -152,7 +152,16 @@ defmodule JSON.LD.ContextTest do
|
|||
|
||||
describe "remote contexts" do
|
||||
test "when the remote context is a list" do
|
||||
assert context = JSON.LD.context("https://dev.poast.org/schemas/litepub-0.1.jsonld")
|
||||
bypass = Bypass.open()
|
||||
|
||||
Bypass.expect(bypass, fn conn ->
|
||||
assert "GET" == conn.method
|
||||
assert "/litepub-0.1.jsonld" == conn.request_path
|
||||
context = File.read!("test/fixtures/litepub-0.1.jsonld")
|
||||
Plug.Conn.resp(conn, 200, context)
|
||||
end)
|
||||
|
||||
assert context = JSON.LD.context("http://localhost:#{bypass.port}/litepub-0.1.jsonld")
|
||||
|
||||
assert %{
|
||||
"Emoji" => "http://joinmastodon.org/ns#Emoji",
|
||||
|
|
Loading…
Reference in a new issue