]> git.r.bdr.sh - rbdr/forum/commitdiff
Apply formatting
authorRuben Beltran del Rio <redacted>
Sat, 30 Apr 2022 23:02:58 +0000 (01:02 +0200)
committerRuben Beltran del Rio <redacted>
Sat, 30 Apr 2022 23:02:58 +0000 (01:02 +0200)
60 files changed:
.gitlab-ci.yml
CHANGELOG.md
README.md
doc/COVERAGE.md
doc/README.md
jest.config.js
pacts/forumclient-forumserver.json
postcss.config.cjs
src/lib/animations/blink.test.ts
src/lib/animations/blink.ts
src/lib/components/actions/topic.svelte
src/lib/components/actions/topic.test.ts
src/lib/components/error_block/error_block.test.ts
src/lib/components/forum/forum.test.ts
src/lib/components/forum_list/forum_list.svelte
src/lib/components/forum_list/forum_list.test.ts
src/lib/components/glyph/glyph.test.ts
src/lib/components/header/header.svelte
src/lib/components/header/header.test.ts
src/lib/components/language_selector/language_selector.svelte
src/lib/components/language_selector/language_selector.test.ts
src/lib/components/post/post.svelte
src/lib/components/post/post.test.ts
src/lib/components/tag/tag.test.ts
src/lib/components/topic/topic.svelte
src/lib/components/topic/topic.test.ts
src/lib/components/topic_summary/topic_summary.svelte
src/lib/components/topic_summary/topic_summary.test.ts
src/lib/config/__mocks__/config.ts
src/lib/config/apollo.ts
src/lib/config/config.ts
src/lib/i18n.ts
src/lib/stores/actions.test.ts
src/lib/stores/actions.ts
src/lib/stores/apollo.ts
src/lib/stores/forums.test.ts
src/lib/stores/forums.ts
src/lib/stores/posts.test.ts
src/lib/stores/tags.test.ts
src/lib/stores/topics.test.ts
src/lib/stores/topics.ts
src/lib/utils/glyph_hash.test.ts
src/lib/utils/glyph_hash.ts
src/lib/utils/readable_time.test.ts
src/lib/utils/readable_time.ts
src/lib/utils/resolve_after.test.ts
src/lib/utils/resolve_after.ts
src/routes/__error.svelte
src/routes/__layout.svelte
src/routes/a/[id].svelte
src/routes/f/[id].svelte
src/routes/g/[id].svelte
src/routes/index.svelte
src/routes/p/[id].svelte
src/routes/t/[id].svelte
static/global.css
static/manifest.webmanifest
svelte.config.js
tailwind.config.cjs
tsconfig.json

index 703003ce331ec428ed4906721a19e57a64334927..b1f4357e3bc79f99d0b63bd42ca0284b182ca99d 100644 (file)
@@ -5,7 +5,7 @@ stages:
   - test
 
 before_script:
-    - npm install
+  - npm install
 
 lint:
   stage: lint
index 6395a24e0d652093e6d21534591d0ad1de774291..40512a24cceb57569aba8e6e37a48c00e0f7f0a6 100644 (file)
@@ -1,11 +1,14 @@
 # Changelog
+
 All notable changes to this project will be documented in this file.
 
 The format is based on [Keep a Changelog](http://keepachangelog.com/)
 and this project adheres to [Semantic Versioning](http://semver.org/).
 
 ## [Unreleased]
+
 ### Added
+
 - Svelte based frontend
 - Koa based backend
 - RethinkDB for backend
@@ -17,4 +20,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
 - NPM tasks to lint and install git hooks
 - A gitignore file
 
-[Unreleased]: https://gitlab.com/rbdr/forum/compare/master...develop
+[unreleased]: https://gitlab.com/rbdr/forum/compare/master...develop
index e8b6201152eb7b3c0ce676e8a7f4a09d6fae0bf4..3e0f099872da2f0944ac77c52756fb317dfd1bea 100644 (file)
--- a/README.md
+++ b/README.md
@@ -20,10 +20,11 @@ You can run tests with `npm test`. The tests use `testing-library`, `pact`,
 and `jest`.
 
 Here's some short guidelines:
-  - Every component that receives props or changes state should be tested.
-  - Test expected outcomes, not implementation details.
-  - Avoid mocking unless it's an external call
-  - Stores that interact with the API should be tested using pact
+
+- Every component that receives props or changes state should be tested.
+- Test expected outcomes, not implementation details.
+- Avoid mocking unless it's an external call
+- Stores that interact with the API should be tested using pact
 
 [node]: https://nodejs.org/en/
 [forum-server]: https://gitlab.com/rbdr/forum-server
index dd1f5efa0dc3cb20dd578cb7a77c1c51e29628ea..09d88104c69705c857b470d1e0c64d3a68c1603d 100644 (file)
@@ -1,31 +1,29 @@
-# Code Quality Report  
-Thu Nov 15 2018 01:45:42 GMT+0100 (Central European Standard Time)  
-  
+# Code Quality Report
+
+Thu Nov 15 2018 01:45:42 GMT+0100 (Central European Standard Time)
+
 ## Tests
-    
+
 **Application Loader**  
-✔ 1) Should instantiate and start Forum on window load (18 ms)  
-  
-  
+✔ 1) Should instantiate and start Forum on window load (18 ms)
+
 1 test  
 0 tests failed  
-0 tests skipped  
-  
-Test duration: 27 ms  
-  
-  
-## Leaks  
-The following global variable leaks were detected:_registeredHandlers, _eventHandlers, DOMException, NamedNodeMap, Attr, Node, Element, DocumentFragment, HTMLDocument, Document, XMLDocument, CharacterData, Text, CDATASection, ProcessingInstruction, Comment, DocumentType, DOMImplementation, NodeList, HTMLCollection, HTMLOptionsCollection, DOMStringMap, DOMTokenList, SVGAnimatedString, SVGNumber, SVGStringList, Event, CloseEvent, CustomEvent, MessageEvent, ErrorEvent, HashChangeEvent, FocusEvent, PopStateEvent, UIEvent, MouseEvent, KeyboardEvent, TouchEvent, ProgressEvent, CompositionEvent, WheelEvent, EventTarget, BarProp, Location, History, Screen, Performance, Blob, File, FileList, DOMParser, FormData, XMLHttpRequestEventTarget, XMLHttpRequestUpload, NodeIterator, TreeWalker, HTMLElement, HTMLAnchorElement, HTMLAreaElement, HTMLAudioElement, HTMLBaseElement, HTMLBodyElement, HTMLBRElement, HTMLButtonElement, HTMLCanvasElement, HTMLDataElement, HTMLDataListElement, HTMLDetailsElement, HTMLDialogElement, HTMLDirectoryElement, HTMLDivElement, HTMLDListElement, HTMLEmbedElement, HTMLFieldSetElement, HTMLFontElement, HTMLFormElement, HTMLFrameElement, HTMLFrameSetElement, HTMLHeadingElement, HTMLHeadElement, HTMLHRElement, HTMLHtmlElement, HTMLIFrameElement, HTMLImageElement, HTMLInputElement, HTMLLabelElement, HTMLLegendElement, HTMLLIElement, HTMLLinkElement, HTMLMapElement, HTMLMarqueeElement, HTMLMediaElement, HTMLMenuElement, HTMLMetaElement, HTMLMeterElement, HTMLModElement, HTMLObjectElement, HTMLOListElement, HTMLOptGroupElement, HTMLOptionElement, HTMLOutputElement, HTMLParagraphElement, HTMLParamElement, HTMLPictureElement, HTMLPreElement, HTMLProgressElement, HTMLQuoteElement, HTMLScriptElement, HTMLSelectElement, HTMLSourceElement, HTMLSpanElement, HTMLStyleElement, HTMLTableCaptionElement, HTMLTableCellElement, HTMLTableColElement, HTMLTableElement, HTMLTimeElement, HTMLTitleElement, HTMLTableRowElement, HTMLTableSectionElement, HTMLTemplateElement, HTMLTextAreaElement, HTMLTrackElement, HTMLUListElement, HTMLUnknownElement, HTMLVideoElement, SVGElement, SVGGraphicsElement, SVGSVGElement, StyleSheet, MediaList, CSSStyleSheet, CSSRule, CSSStyleRule, CSSMediaRule, CSSImportRule, CSSStyleDeclaration, StyleSheetList, XPathException, XPathExpression, XPathResult, XPathEvaluator, NodeFilter, Window, _globalProxy, _document, _sessionHistory, _virtualConsole, _runScripts, _top, _parent, _frameElement, _length, _pretendToBeVisual, length, window, frameElement, frames, self, parent, top, document, external, location, history, navigator, locationbar, menubar, personalbar, scrollbars, statusbar, toolbar, performance, screen, addEventListener, removeEventListener, dispatchEvent, __stopAllTimers, Option, Image, Audio, postMessage, atob, btoa, FileReader, WebSocket, AbortSignal, AbortController, XMLHttpRequest, stop, close, getComputedStyle, captureEvents, releaseEvents, name, devicePixelRatio, innerWidth, innerHeight, outerWidth, outerHeight, pageXOffset, pageYOffset, screenX, screenY, scrollX, scrollY, screenLeft, screenTop, alert, blur, confirm, focus, moveBy, moveTo, open, print, prompt, resizeBy, resizeTo, scroll, scrollBy, scrollTo  
-  
-  
-## Coverage  
+0 tests skipped
+
+Test duration: 27 ms
+
+## Leaks
+
+The following global variable leaks were detected:\_registeredHandlers, \_eventHandlers, DOMException, NamedNodeMap, Attr, Node, Element, DocumentFragment, HTMLDocument, Document, XMLDocument, CharacterData, Text, CDATASection, ProcessingInstruction, Comment, DocumentType, DOMImplementation, NodeList, HTMLCollection, HTMLOptionsCollection, DOMStringMap, DOMTokenList, SVGAnimatedString, SVGNumber, SVGStringList, Event, CloseEvent, CustomEvent, MessageEvent, ErrorEvent, HashChangeEvent, FocusEvent, PopStateEvent, UIEvent, MouseEvent, KeyboardEvent, TouchEvent, ProgressEvent, CompositionEvent, WheelEvent, EventTarget, BarProp, Location, History, Screen, Performance, Blob, File, FileList, DOMParser, FormData, XMLHttpRequestEventTarget, XMLHttpRequestUpload, NodeIterator, TreeWalker, HTMLElement, HTMLAnchorElement, HTMLAreaElement, HTMLAudioElement, HTMLBaseElement, HTMLBodyElement, HTMLBRElement, HTMLButtonElement, HTMLCanvasElement, HTMLDataElement, HTMLDataListElement, HTMLDetailsElement, HTMLDialogElement, HTMLDirectoryElement, HTMLDivElement, HTMLDListElement, HTMLEmbedElement, HTMLFieldSetElement, HTMLFontElement, HTMLFormElement, HTMLFrameElement, HTMLFrameSetElement, HTMLHeadingElement, HTMLHeadElement, HTMLHRElement, HTMLHtmlElement, HTMLIFrameElement, HTMLImageElement, HTMLInputElement, HTMLLabelElement, HTMLLegendElement, HTMLLIElement, HTMLLinkElement, HTMLMapElement, HTMLMarqueeElement, HTMLMediaElement, HTMLMenuElement, HTMLMetaElement, HTMLMeterElement, HTMLModElement, HTMLObjectElement, HTMLOListElement, HTMLOptGroupElement, HTMLOptionElement, HTMLOutputElement, HTMLParagraphElement, HTMLParamElement, HTMLPictureElement, HTMLPreElement, HTMLProgressElement, HTMLQuoteElement, HTMLScriptElement, HTMLSelectElement, HTMLSourceElement, HTMLSpanElement, HTMLStyleElement, HTMLTableCaptionElement, HTMLTableCellElement, HTMLTableColElement, HTMLTableElement, HTMLTimeElement, HTMLTitleElement, HTMLTableRowElement, HTMLTableSectionElement, HTMLTemplateElement, HTMLTextAreaElement, HTMLTrackElement, HTMLUListElement, HTMLUnknownElement, HTMLVideoElement, SVGElement, SVGGraphicsElement, SVGSVGElement, StyleSheet, MediaList, CSSStyleSheet, CSSRule, CSSStyleRule, CSSMediaRule, CSSImportRule, CSSStyleDeclaration, StyleSheetList, XPathException, XPathExpression, XPathResult, XPathEvaluator, NodeFilter, Window, \_globalProxy, \_document, \_sessionHistory, \_virtualConsole, \_runScripts, \_top, \_parent, \_frameElement, \_length, \_pretendToBeVisual, length, window, frameElement, frames, self, parent, top, document, external, location, history, navigator, locationbar, menubar, personalbar, scrollbars, statusbar, toolbar, performance, screen, addEventListener, removeEventListener, dispatchEvent, \_\_stopAllTimers, Option, Image, Audio, postMessage, atob, btoa, FileReader, WebSocket, AbortSignal, AbortController, XMLHttpRequest, stop, close, getComputedStyle, captureEvents, releaseEvents, name, devicePixelRatio, innerWidth, innerHeight, outerWidth, outerHeight, pageXOffset, pageYOffset, screenX, screenY, scrollX, scrollY, screenLeft, screenTop, alert, blur, confirm, focus, moveBy, moveTo, open, print, prompt, resizeBy, resizeTo, scroll, scrollBy, scrollTo
+
+## Coverage
+
 Threshold: 100%  
-Coverage: 0.00% (0/0)  
-  
-  
-  
-## Linting  
+Coverage: 0.00% (0/0)
+
+## Linting
+
 Warnings threshold: 0  
 Errors threshold: 0  
-No issues  
-  
+No issues
index f294b0fae13e9021cdbf95643072cac6632778cf..d3119e050f59b162c6cc6028e91d13449cfb6682 100644 (file)
@@ -25,16 +25,17 @@ the forum object.</p>
 <a name="module_Forum"></a>
 
 ## Forum
-The Forum class is the main entry point for the backend application.
 
+The Forum class is the main entry point for the backend application.
 
-| Param | Type | Description |
-| --- | --- | --- |
+| Param  | Type                                                                   | Description                                       |
+| ------ | ---------------------------------------------------------------------- | ------------------------------------------------- |
 | config | [<code>tForumBackendConfiguration</code>](#tForumBackendConfiguration) | the initialization options to extend the instance |
 
 <a name="module_Forum+run"></a>
 
 ### forum.run()
+
 Initializes the application and starts listening. Also prints a
 nice robotic banner with information.
 
@@ -42,6 +43,7 @@ nice robotic banner with information.
 <a name="tForumBackendConfiguration"></a>
 
 ## tForumBackendConfiguration : <code>object</code>
+
 The main configuration object for the Forum backend. It will be used to
 initialize all of the sub-components. It can extend any property of
 the forum object.
@@ -49,37 +51,38 @@ the forum object.
 **Kind**: global typedef  
 **Properties**
 
-| Name | Type | Default | Description |
-| --- | --- | --- | --- |
-| [port] | <code>number</code> | <code>1978</code> | the port where the app will listen on |
-| [staticDirectory] | <code>string</code> | <code>&quot;static&quot;</code> | the path, relative to the project root, where static assets live |
-| [ttl] | <code>number</code> | <code>180</code> | the time in seconds that posts remain alive |
-| rethinkDB | [<code>tRethinkDBConfiguration</code>](#tRethinkDBConfiguration) |  | the configuration to connect to the rethinkDB server |
-| jwt | [<code>tJWTConfiguration</code>](#tJWTConfiguration) |  | the configuration for the JWT authentication |
+| Name              | Type                                                             | Default                         | Description                                                      |
+| ----------------- | ---------------------------------------------------------------- | ------------------------------- | ---------------------------------------------------------------- |
+| [port]            | <code>number</code>                                              | <code>1978</code>               | the port where the app will listen on                            |
+| [staticDirectory] | <code>string</code>                                              | <code>&quot;static&quot;</code> | the path, relative to the project root, where static assets live |
+| [ttl]             | <code>number</code>                                              | <code>180</code>                | the time in seconds that posts remain alive                      |
+| rethinkDB         | [<code>tRethinkDBConfiguration</code>](#tRethinkDBConfiguration) |                                 | the configuration to connect to the rethinkDB server             |
+| jwt               | [<code>tJWTConfiguration</code>](#tJWTConfiguration)             |                                 | the configuration for the JWT authentication                     |
 
 <a name="tJWTConfiguration"></a>
 
 ## tJWTConfiguration : <code>object</code>
+
 Configures the behavior of the JWT token.
 
 **Kind**: global typedef  
 **Properties**
 
-| Name | Type | Default | Description |
-| --- | --- | --- | --- |
+| Name       | Type                | Default            | Description                        |
+| ---------- | ------------------- | ------------------ | ---------------------------------- |
 | [duration] | <code>number</code> | <code>86400</code> | the duration of the JWT in seconds |
-| secret | <code>string</code> |  | the secret used to sign the JWT |
+| secret     | <code>string</code> |                    | the secret used to sign the JWT    |
 
 <a name="tRethinkDBConfiguration"></a>
 
 ## tRethinkDBConfiguration : <code>object</code>
+
 Information required to connect to the rethinkDB server
 
 **Kind**: global typedef  
 **Properties**
 
-| Name | Type | Default | Description |
-| --- | --- | --- | --- |
-| host | <code>string</code> |  | the location of the rethinkDB host |
+| Name   | Type                | Default           | Description                              |
+| ------ | ------------------- | ----------------- | ---------------------------------------- |
+| host   | <code>string</code> |                   | the location of the rethinkDB host       |
 | [post] | <code>string</code> | <code>6379</code> | port where rethinkDB server is listening |
-
index 6b808fc65713cdad7c02415757e7ee50bef000c6..0e21d6ba8c7c97f9cf380f11d954da0228eb4ae5 100644 (file)
@@ -1,24 +1,24 @@
 /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
 export default {
-  preset: "ts-jest",
-  transform: {
-    "^.+\\.svelte$": [
-      "svelte-jester",
-      {
-        "preprocess": true
-      }
-    ]
-  },
-  moduleNameMapper: {
-    "^\\$lib(.*)$": "<rootDir>/src/lib$1",
-    "^\\$app(.*)$": [".svelte/dev/runtime/app/*", ".svelte/build/runtime/app/*"]
-  },
-  moduleFileExtensions: ["ts", "js", "svelte"],
-  globals: {
-    'ts-jest': {
-      diagnostics: {
-        ignoreCodes: [ 'TS151001' ],
-      },
-    },
-  },
-}
+       preset: 'ts-jest',
+       transform: {
+               '^.+\\.svelte$': [
+                       'svelte-jester',
+                       {
+                               preprocess: true
+                       }
+               ]
+       },
+       moduleNameMapper: {
+               '^\\$lib(.*)$': '<rootDir>/src/lib$1',
+               '^\\$app(.*)$': ['.svelte/dev/runtime/app/*', '.svelte/build/runtime/app/*']
+       },
+       moduleFileExtensions: ['ts', 'js', 'svelte'],
+       globals: {
+               'ts-jest': {
+                       diagnostics: {
+                               ignoreCodes: ['TS151001']
+                       }
+               }
+       }
+};
index 9ec37f83890bf209498b47103c0fb661c499878b..c4d529c92a851e5239126b280e4acde84db2d82d 100644 (file)
 {
-  "consumer": {
-    "name": "ForumClient"
-  },
-  "provider": {
-    "name": "ForumServer"
-  },
-  "interactions": [
-    {
-      "description": "a request to list the forums",
-      "providerState": "there's data",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetForums",
-          "query": "query GetForums {\n              forums {\n                id\n                glyph\n                label\n                position\n                __typename\n              }\n            }",
-          "variables": {
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 200,
-        "headers": {
-          "Content-Type": "application/json; charset=utf-8"
-        },
-        "body": {
-          "data": {
-            "forums": [
-              {
-                "id": "butter",
-                "glyph": "⌘",
-                "label": "test_forums.butter",
-                "position": 1
-              }
-            ]
-          }
-        },
-        "matchingRules": {
-          "$.body.data.forums": {
-            "min": 1
-          },
-          "$.body.data.forums[*].*": {
-            "match": "type"
-          },
-          "$.body.data.forums[*].id": {
-            "match": "type"
-          },
-          "$.body.data.forums[*].glyph": {
-            "match": "type"
-          },
-          "$.body.data.forums[*].label": {
-            "match": "type"
-          },
-          "$.body.data.forums[*].position": {
-            "match": "type"
-          }
-        }
-      }
-    },
-    {
-      "description": "a request to get a single forum",
-      "providerState": "there's data",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetForum",
-          "query": "query GetForum($id: ID!) {\n              forum(id: $id) {\n                id\n                glyph\n                label\n                position\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
-          "variables": {
-            "id": "freezer"
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetForum\\(\\$id:\\s*ID!\\)\\s*\\{\\s*forum\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 200,
-        "headers": {
-          "Content-Type": "application/json; charset=utf-8"
-        },
-        "body": {
-          "data": {
-            "forum": {
-              "id": "freezer",
-              "glyph": "✭",
-              "label": "test_forums.freezer",
-              "position": 3,
-              "topics": [
-                {
-                  "id": "629de02c-151a-4db7-bb86-43b2add8a15a",
-                  "title": "Very pacty topic",
-                  "updated_at": 1619954611616,
-                  "ttl": 3601
-                }
-              ]
-            }
-          }
-        },
-        "matchingRules": {
-          "$.body.data.forum": {
-            "match": "type"
-          },
-          "$.body.data.forum.glyph": {
-            "match": "type"
-          },
-          "$.body.data.forum.label": {
-            "match": "type"
-          },
-          "$.body.data.forum.position": {
-            "match": "type"
-          },
-          "$.body.data.forum.topics": {
-            "min": 1
-          },
-          "$.body.data.forum.topics[*].*": {
-            "match": "type"
-          },
-          "$.body.data.forum.topics[*].id": {
-            "match": "type"
-          },
-          "$.body.data.forum.topics[*].title": {
-            "match": "type"
-          },
-          "$.body.data.forum.topics[*].updated_at": {
-            "match": "type"
-          },
-          "$.body.data.forum.topics[*].ttl": {
-            "match": "type"
-          }
-        }
-      }
-    },
-    {
-      "description": "a request to list the forums",
-      "providerState": "there's no data",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetForums",
-          "query": "query GetForums {\n              forums {\n                id\n                glyph\n                label\n                position\n                __typename\n              }\n            }",
-          "variables": {
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 200,
-        "headers": {
-          "Content-Type": "application/json; charset=utf-8"
-        },
-        "body": {
-          "data": {
-            "forums": [
-
-            ]
-          }
-        }
-      }
-    },
-    {
-      "description": "a request to get a single forum",
-      "providerState": "there's no data",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetForum",
-          "query": "query GetForum($id: ID!) {\n              forum(id: $id) {\n                id\n                glyph\n                label\n                position\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
-          "variables": {
-            "id": "freezer"
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetForum\\(\\$id:\\s*ID!\\)\\s*\\{\\s*forum\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 200,
-        "headers": {
-          "Content-Type": "application/json; charset=utf-8"
-        },
-        "body": {
-          "data": {
-            "forum": null
-          }
-        }
-      }
-    },
-    {
-      "description": "a request to list the forums",
-      "providerState": "there's a server error",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetForums",
-          "query": "query GetForums {\n              forums {\n                id\n                glyph\n                label\n                position\n                __typename\n              }\n            }",
-          "variables": {
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 500,
-        "headers": {
-        }
-      }
-    },
-    {
-      "description": "a request to get a single forum",
-      "providerState": "there's a server error",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetForum",
-          "query": "query GetForum($id: ID!) {\n              forum(id: $id) {\n                id\n                glyph\n                label\n                position\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
-          "variables": {
-            "id": "freezer"
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetForum\\(\\$id:\\s*ID!\\)\\s*\\{\\s*forum\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 500,
-        "headers": {
-        }
-      }
-    },
-    {
-      "description": "a request to list the forums",
-      "providerState": "there's an error in the response",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetForums",
-          "query": "query GetForums {\n              forums {\n                id\n                glyph\n                label\n                position\n                __typename\n              }\n            }",
-          "variables": {
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 200,
-        "headers": {
-          "Content-Type": "application/json; charset=utf-8"
-        },
-        "body": {
-          "errors": [
-            {
-              "message": "An error occurred when fetching forums"
-            }
-          ]
-        },
-        "matchingRules": {
-          "$.body.errors": {
-            "min": 1
-          },
-          "$.body.errors[*].*": {
-            "match": "type"
-          },
-          "$.body.errors[*].message": {
-            "match": "type"
-          }
-        }
-      }
-    },
-    {
-      "description": "a request to get a single forum",
-      "providerState": "there's an error in the response",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetForum",
-          "query": "query GetForum($id: ID!) {\n              forum(id: $id) {\n                id\n                glyph\n                label\n                position\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
-          "variables": {
-            "id": "freezer"
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetForum\\(\\$id:\\s*ID!\\)\\s*\\{\\s*forum\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 200,
-        "headers": {
-          "Content-Type": "application/json; charset=utf-8"
-        },
-        "body": {
-          "errors": [
-            {
-              "message": "An error occurred when fetching the forum"
-            }
-          ]
-        },
-        "matchingRules": {
-          "$.body.errors": {
-            "min": 1
-          },
-          "$.body.errors[*].*": {
-            "match": "type"
-          },
-          "$.body.errors[*].message": {
-            "match": "type"
-          }
-        }
-      }
-    },
-    {
-      "description": "a request to get a single topic",
-      "providerState": "there's data",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetTopic",
-          "query": "query GetTopic($id: ID!) {\n              topic(id: $id) {\n                id\n                title\n                updated_at\n                ttl\n                forum {\n                  id\n                  glyph\n                  label\n                  __typename\n                }\n                tags {\n                  id\n                  weight\n                  __typename\n                }\n                posts {\n                  id\n                  text\n                  created_at\n                  author {\n                    id\n                    handle\n                    __typename\n                  }\n                  __typename\n                }\n                __typename\n              }\n            }",
-          "variables": {
-            "id": "0b58959d-d448-4a4e-84b6-35e5ac0028d1"
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetTopic\\(\\$id:\\s*ID!\\)\\s*\\{\\s*topic\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*forum\\s*\\{\\s*id\\s*glyph\\s*label\\s*__typename\\s*\\}\\s*tags\\s*\\{\\s*id\\s*weight\\s*__typename\\s*\\}\\s*posts\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 200,
-        "headers": {
-          "Content-Type": "application/json; charset=utf-8"
-        },
-        "body": {
-          "data": {
-            "topic": {
-              "id": "0b58959d-d448-4a4e-84b6-35e5ac0028d1",
-              "title": "The pacty topic of the day",
-              "updated_at": 1619979888906,
-              "ttl": 3399,
-              "forum": {
-                "id": "cucumber",
-                "glyph": "✽",
-                "label": "test_forums.cucumber"
-              },
-              "tags": [
-                {
-                  "id": "skunk",
-                  "weight": 44
-                }
-              ],
-              "posts": [
-                {
-                  "id": "ed93530e-6f9c-4701-91ef-14f9e0ed3e26",
-                  "text": "The content of this post is very relevant",
-                  "created_at": 1619979889798,
-                  "author": {
-                    "id": "07fb2ba0-0945-464a-b215-873296710c8c",
-                    "handle": "cucumber_fan92"
-                  }
-                }
-              ]
-            }
-          }
-        },
-        "matchingRules": {
-          "$.body.data.topic.id": {
-            "match": "type"
-          },
-          "$.body.data.topic.title": {
-            "match": "type"
-          },
-          "$.body.data.topic.updated_at": {
-            "match": "type"
-          },
-          "$.body.data.topic.ttl": {
-            "match": "type"
-          },
-          "$.body.data.topic.forum.id": {
-            "match": "type"
-          },
-          "$.body.data.topic.forum.glyph": {
-            "match": "type"
-          },
-          "$.body.data.topic.forum.label": {
-            "match": "type"
-          },
-          "$.body.data.topic.tags": {
-            "min": 1
-          },
-          "$.body.data.topic.tags[*].*": {
-            "match": "type"
-          },
-          "$.body.data.topic.tags[*].id": {
-            "match": "type"
-          },
-          "$.body.data.topic.tags[*].weight": {
-            "match": "type"
-          },
-          "$.body.data.topic.posts": {
-            "min": 1
-          },
-          "$.body.data.topic.posts[*].*": {
-            "match": "type"
-          },
-          "$.body.data.topic.posts[*].id": {
-            "match": "type"
-          },
-          "$.body.data.topic.posts[*].text": {
-            "match": "type"
-          },
-          "$.body.data.topic.posts[*].created_at": {
-            "match": "type"
-          },
-          "$.body.data.topic.posts[*].author": {
-            "match": "type"
-          },
-          "$.body.data.topic.posts[*].author.id": {
-            "match": "type"
-          },
-          "$.body.data.topic.posts[*].author.handle": {
-            "match": "type"
-          }
-        }
-      }
-    },
-    {
-      "description": "a request to get a single topic",
-      "providerState": "there's no data",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetTopic",
-          "query": "query GetTopic($id: ID!) {\n              topic(id: $id) {\n                id\n                title\n                updated_at\n                ttl\n                forum {\n                  id\n                  glyph\n                  label\n                  __typename\n                }\n                tags {\n                  id\n                  weight\n                  __typename\n                }\n                posts {\n                  id\n                  text\n                  created_at\n                  author {\n                    id\n                    handle\n                    __typename\n                  }\n                  __typename\n                }\n                __typename\n              }\n            }",
-          "variables": {
-            "id": "0b58959d-d448-4a4e-84b6-35e5ac0028d1"
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetTopic\\(\\$id:\\s*ID!\\)\\s*\\{\\s*topic\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*forum\\s*\\{\\s*id\\s*glyph\\s*label\\s*__typename\\s*\\}\\s*tags\\s*\\{\\s*id\\s*weight\\s*__typename\\s*\\}\\s*posts\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 200,
-        "headers": {
-          "Content-Type": "application/json; charset=utf-8"
-        },
-        "body": {
-          "data": {
-            "topic": null
-          }
-        }
-      }
-    },
-    {
-      "description": "a request to get a single topic",
-      "providerState": "there's a server error",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetTopic",
-          "query": "query GetTopic($id: ID!) {\n              topic(id: $id) {\n                id\n                title\n                updated_at\n                ttl\n                forum {\n                  id\n                  glyph\n                  label\n                  __typename\n                }\n                tags {\n                  id\n                  weight\n                  __typename\n                }\n                posts {\n                  id\n                  text\n                  created_at\n                  author {\n                    id\n                    handle\n                    __typename\n                  }\n                  __typename\n                }\n                __typename\n              }\n            }",
-          "variables": {
-            "id": "0b58959d-d448-4a4e-84b6-35e5ac0028d1"
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetTopic\\(\\$id:\\s*ID!\\)\\s*\\{\\s*topic\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*forum\\s*\\{\\s*id\\s*glyph\\s*label\\s*__typename\\s*\\}\\s*tags\\s*\\{\\s*id\\s*weight\\s*__typename\\s*\\}\\s*posts\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 500,
-        "headers": {
-        }
-      }
-    },
-    {
-      "description": "a request to get a single topic",
-      "providerState": "there's an error in the response",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetTopic",
-          "query": "query GetTopic($id: ID!) {\n              topic(id: $id) {\n                id\n                title\n                updated_at\n                ttl\n                forum {\n                  id\n                  glyph\n                  label\n                  __typename\n                }\n                tags {\n                  id\n                  weight\n                  __typename\n                }\n                posts {\n                  id\n                  text\n                  created_at\n                  author {\n                    id\n                    handle\n                    __typename\n                  }\n                  __typename\n                }\n                __typename\n              }\n            }",
-          "variables": {
-            "id": "0b58959d-d448-4a4e-84b6-35e5ac0028d1"
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetTopic\\(\\$id:\\s*ID!\\)\\s*\\{\\s*topic\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*forum\\s*\\{\\s*id\\s*glyph\\s*label\\s*__typename\\s*\\}\\s*tags\\s*\\{\\s*id\\s*weight\\s*__typename\\s*\\}\\s*posts\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 200,
-        "headers": {
-          "Content-Type": "application/json; charset=utf-8"
-        },
-        "body": {
-          "errors": [
-            {
-              "message": "An error occurred when fetching the topic"
-            }
-          ]
-        },
-        "matchingRules": {
-          "$.body.errors": {
-            "min": 1
-          },
-          "$.body.errors[*].*": {
-            "match": "type"
-          },
-          "$.body.errors[*].message": {
-            "match": "type"
-          }
-        }
-      }
-    },
-    {
-      "description": "a request to get a single tag",
-      "providerState": "there's data",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetTag",
-          "query": "query GetTag($id: ID!) {\n              tag(id: $id) {\n                id\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
-          "variables": {
-            "id": "pineapple"
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetTag\\(\\$id:\\s*ID!\\)\\s*\\{\\s*tag\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 200,
-        "headers": {
-          "Content-Type": "application/json; charset=utf-8"
-        },
-        "body": {
-          "data": {
-            "tag": {
-              "id": "pineapple",
-              "topics": [
-                {
-                  "id": "cd038ae7-e8b4-4e38-9543-3d697e69ac34",
-                  "title": "This topic is about pineapples",
-                  "updated_at": 1619978944077,
-                  "ttl": 3555
-                }
-              ]
-            }
-          }
-        },
-        "matchingRules": {
-          "$.body.data.tag.id": {
-            "match": "type"
-          },
-          "$.body.data.tag.topics": {
-            "min": 1
-          },
-          "$.body.data.tag.topics[*].*": {
-            "match": "type"
-          },
-          "$.body.data.tag.topics[*].id": {
-            "match": "type"
-          },
-          "$.body.data.tag.topics[*].title": {
-            "match": "type"
-          },
-          "$.body.data.tag.topics[*].updated_at": {
-            "match": "type"
-          },
-          "$.body.data.tag.topics[*].ttl": {
-            "match": "type"
-          }
-        }
-      }
-    },
-    {
-      "description": "a request to get a single tag",
-      "providerState": "there's no data",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetTag",
-          "query": "query GetTag($id: ID!) {\n              tag(id: $id) {\n                id\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
-          "variables": {
-            "id": "pineapple"
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetTag\\(\\$id:\\s*ID!\\)\\s*\\{\\s*tag\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 200,
-        "headers": {
-          "Content-Type": "application/json; charset=utf-8"
-        },
-        "body": {
-          "data": {
-            "tag": null
-          }
-        }
-      }
-    },
-    {
-      "description": "a request to get a single tag",
-      "providerState": "there's a server error",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetTag",
-          "query": "query GetTag($id: ID!) {\n              tag(id: $id) {\n                id\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
-          "variables": {
-            "id": "pineapple"
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetTag\\(\\$id:\\s*ID!\\)\\s*\\{\\s*tag\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 500,
-        "headers": {
-        }
-      }
-    },
-    {
-      "description": "a request to get a single tag",
-      "providerState": "there's an error in the response",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetTag",
-          "query": "query GetTag($id: ID!) {\n              tag(id: $id) {\n                id\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
-          "variables": {
-            "id": "pineapple"
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetTag\\(\\$id:\\s*ID!\\)\\s*\\{\\s*tag\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 200,
-        "headers": {
-          "Content-Type": "application/json; charset=utf-8"
-        },
-        "body": {
-          "errors": [
-            {
-              "message": "An error occurred when fetching the tag"
-            }
-          ]
-        },
-        "matchingRules": {
-          "$.body.errors": {
-            "min": 1
-          },
-          "$.body.errors[*].*": {
-            "match": "type"
-          },
-          "$.body.errors[*].message": {
-            "match": "type"
-          }
-        }
-      }
-    },
-    {
-      "description": "a request to get a single post",
-      "providerState": "there's data",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetPost",
-          "query": "query GetPost($id: ID!) {\n              post(id: $id) {\n                id\n                text\n                created_at\n                author {\n                  id\n                  handle\n                  __typename\n                }\n                topic {\n                  id\n                  title\n                  __typename\n                }\n                __typename\n              }\n            }",
-          "variables": {
-            "id": "8f75eba5-6989-4dd3-b466-e464546ce374"
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetPost\\(\\$id:\\s*ID!\\)\\s*\\{\\s*post\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*topic\\s*\\{\\s*id\\s*title\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 200,
-        "headers": {
-          "Content-Type": "application/json; charset=utf-8"
-        },
-        "body": {
-          "data": {
-            "post": {
-              "id": "8f75eba5-6989-4dd3-b466-e464546ce374",
-              "text": "This is a very pacty post",
-              "created_at": 1619976194937,
-              "author": {
-                "id": "a805b3de-cac4-451c-a1e6-f078869c9db9",
-                "handle": "pacts_person"
-              },
-              "topic": {
-                "id": "5c283ce1-0470-4b98-86f5-1fec9a22c9ac",
-                "title": "The parent pacts topic"
-              }
-            }
-          }
-        },
-        "matchingRules": {
-          "$.body.data.post": {
-            "match": "type"
-          },
-          "$.body.data.post.id": {
-            "match": "type"
-          },
-          "$.body.data.post.text": {
-            "match": "type"
-          },
-          "$.body.data.post.created_at": {
-            "match": "type"
-          },
-          "$.body.data.post.author": {
-            "match": "type"
-          },
-          "$.body.data.post.author.id": {
-            "match": "type"
-          },
-          "$.body.data.post.author.handle": {
-            "match": "type"
-          },
-          "$.body.data.post.topic": {
-            "match": "type"
-          },
-          "$.body.data.post.topic.id": {
-            "match": "type"
-          },
-          "$.body.data.post.topic.title": {
-            "match": "type"
-          }
-        }
-      }
-    },
-    {
-      "description": "a request to get a single post",
-      "providerState": "there's no data",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetPost",
-          "query": "query GetPost($id: ID!) {\n              post(id: $id) {\n                id\n                text\n                created_at\n                author {\n                  id\n                  handle\n                  __typename\n                }\n                topic {\n                  id\n                  title\n                  __typename\n                }\n                __typename\n              }\n            }",
-          "variables": {
-            "id": "8f75eba5-6989-4dd3-b466-e464546ce374"
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetPost\\(\\$id:\\s*ID!\\)\\s*\\{\\s*post\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*topic\\s*\\{\\s*id\\s*title\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 200,
-        "headers": {
-          "Content-Type": "application/json; charset=utf-8"
-        },
-        "body": {
-          "data": {
-            "post": null
-          }
-        }
-      }
-    },
-    {
-      "description": "a request to get a single post",
-      "providerState": "there's a server error",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetPost",
-          "query": "query GetPost($id: ID!) {\n              post(id: $id) {\n                id\n                text\n                created_at\n                author {\n                  id\n                  handle\n                  __typename\n                }\n                topic {\n                  id\n                  title\n                  __typename\n                }\n                __typename\n              }\n            }",
-          "variables": {
-            "id": "8f75eba5-6989-4dd3-b466-e464546ce374"
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetPost\\(\\$id:\\s*ID!\\)\\s*\\{\\s*post\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*topic\\s*\\{\\s*id\\s*title\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 500,
-        "headers": {
-        }
-      }
-    },
-    {
-      "description": "a request to get a single post",
-      "providerState": "there's an error in the response",
-      "request": {
-        "method": "POST",
-        "path": "/graphql",
-        "headers": {
-          "content-type": "application/json"
-        },
-        "body": {
-          "operationName": "GetPost",
-          "query": "query GetPost($id: ID!) {\n              post(id: $id) {\n                id\n                text\n                created_at\n                author {\n                  id\n                  handle\n                  __typename\n                }\n                topic {\n                  id\n                  title\n                  __typename\n                }\n                __typename\n              }\n            }",
-          "variables": {
-            "id": "8f75eba5-6989-4dd3-b466-e464546ce374"
-          }
-        },
-        "matchingRules": {
-          "$.body.query": {
-            "match": "regex",
-            "regex": "query\\s*GetPost\\(\\$id:\\s*ID!\\)\\s*\\{\\s*post\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*topic\\s*\\{\\s*id\\s*title\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
-          }
-        }
-      },
-      "response": {
-        "status": 200,
-        "headers": {
-          "Content-Type": "application/json; charset=utf-8"
-        },
-        "body": {
-          "errors": [
-            {
-              "message": "An error occurred when fetching the post"
-            }
-          ]
-        },
-        "matchingRules": {
-          "$.body.errors": {
-            "min": 1
-          },
-          "$.body.errors[*].*": {
-            "match": "type"
-          },
-          "$.body.errors[*].message": {
-            "match": "type"
-          }
-        }
-      }
-    }
-  ],
-  "metadata": {
-    "pactSpecification": {
-      "version": "2.0.0"
-    }
-  }
-}
\ No newline at end of file
+       "consumer": {
+               "name": "ForumClient"
+       },
+       "provider": {
+               "name": "ForumServer"
+       },
+       "interactions": [
+               {
+                       "description": "a request to list the forums",
+                       "providerState": "there's data",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetForums",
+                                       "query": "query GetForums {\n              forums {\n                id\n                glyph\n                label\n                position\n                __typename\n              }\n            }",
+                                       "variables": {}
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 200,
+                               "headers": {
+                                       "Content-Type": "application/json; charset=utf-8"
+                               },
+                               "body": {
+                                       "data": {
+                                               "forums": [
+                                                       {
+                                                               "id": "butter",
+                                                               "glyph": "⌘",
+                                                               "label": "test_forums.butter",
+                                                               "position": 1
+                                                       }
+                                               ]
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.data.forums": {
+                                               "min": 1
+                                       },
+                                       "$.body.data.forums[*].*": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.forums[*].id": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.forums[*].glyph": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.forums[*].label": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.forums[*].position": {
+                                               "match": "type"
+                                       }
+                               }
+                       }
+               },
+               {
+                       "description": "a request to get a single forum",
+                       "providerState": "there's data",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetForum",
+                                       "query": "query GetForum($id: ID!) {\n              forum(id: $id) {\n                id\n                glyph\n                label\n                position\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
+                                       "variables": {
+                                               "id": "freezer"
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetForum\\(\\$id:\\s*ID!\\)\\s*\\{\\s*forum\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 200,
+                               "headers": {
+                                       "Content-Type": "application/json; charset=utf-8"
+                               },
+                               "body": {
+                                       "data": {
+                                               "forum": {
+                                                       "id": "freezer",
+                                                       "glyph": "✭",
+                                                       "label": "test_forums.freezer",
+                                                       "position": 3,
+                                                       "topics": [
+                                                               {
+                                                                       "id": "629de02c-151a-4db7-bb86-43b2add8a15a",
+                                                                       "title": "Very pacty topic",
+                                                                       "updated_at": 1619954611616,
+                                                                       "ttl": 3601
+                                                               }
+                                                       ]
+                                               }
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.data.forum": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.forum.glyph": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.forum.label": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.forum.position": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.forum.topics": {
+                                               "min": 1
+                                       },
+                                       "$.body.data.forum.topics[*].*": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.forum.topics[*].id": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.forum.topics[*].title": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.forum.topics[*].updated_at": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.forum.topics[*].ttl": {
+                                               "match": "type"
+                                       }
+                               }
+                       }
+               },
+               {
+                       "description": "a request to list the forums",
+                       "providerState": "there's no data",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetForums",
+                                       "query": "query GetForums {\n              forums {\n                id\n                glyph\n                label\n                position\n                __typename\n              }\n            }",
+                                       "variables": {}
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 200,
+                               "headers": {
+                                       "Content-Type": "application/json; charset=utf-8"
+                               },
+                               "body": {
+                                       "data": {
+                                               "forums": []
+                                       }
+                               }
+                       }
+               },
+               {
+                       "description": "a request to get a single forum",
+                       "providerState": "there's no data",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetForum",
+                                       "query": "query GetForum($id: ID!) {\n              forum(id: $id) {\n                id\n                glyph\n                label\n                position\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
+                                       "variables": {
+                                               "id": "freezer"
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetForum\\(\\$id:\\s*ID!\\)\\s*\\{\\s*forum\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 200,
+                               "headers": {
+                                       "Content-Type": "application/json; charset=utf-8"
+                               },
+                               "body": {
+                                       "data": {
+                                               "forum": null
+                                       }
+                               }
+                       }
+               },
+               {
+                       "description": "a request to list the forums",
+                       "providerState": "there's a server error",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetForums",
+                                       "query": "query GetForums {\n              forums {\n                id\n                glyph\n                label\n                position\n                __typename\n              }\n            }",
+                                       "variables": {}
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 500,
+                               "headers": {}
+                       }
+               },
+               {
+                       "description": "a request to get a single forum",
+                       "providerState": "there's a server error",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetForum",
+                                       "query": "query GetForum($id: ID!) {\n              forum(id: $id) {\n                id\n                glyph\n                label\n                position\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
+                                       "variables": {
+                                               "id": "freezer"
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetForum\\(\\$id:\\s*ID!\\)\\s*\\{\\s*forum\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 500,
+                               "headers": {}
+                       }
+               },
+               {
+                       "description": "a request to list the forums",
+                       "providerState": "there's an error in the response",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetForums",
+                                       "query": "query GetForums {\n              forums {\n                id\n                glyph\n                label\n                position\n                __typename\n              }\n            }",
+                                       "variables": {}
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 200,
+                               "headers": {
+                                       "Content-Type": "application/json; charset=utf-8"
+                               },
+                               "body": {
+                                       "errors": [
+                                               {
+                                                       "message": "An error occurred when fetching forums"
+                                               }
+                                       ]
+                               },
+                               "matchingRules": {
+                                       "$.body.errors": {
+                                               "min": 1
+                                       },
+                                       "$.body.errors[*].*": {
+                                               "match": "type"
+                                       },
+                                       "$.body.errors[*].message": {
+                                               "match": "type"
+                                       }
+                               }
+                       }
+               },
+               {
+                       "description": "a request to get a single forum",
+                       "providerState": "there's an error in the response",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetForum",
+                                       "query": "query GetForum($id: ID!) {\n              forum(id: $id) {\n                id\n                glyph\n                label\n                position\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
+                                       "variables": {
+                                               "id": "freezer"
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetForum\\(\\$id:\\s*ID!\\)\\s*\\{\\s*forum\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 200,
+                               "headers": {
+                                       "Content-Type": "application/json; charset=utf-8"
+                               },
+                               "body": {
+                                       "errors": [
+                                               {
+                                                       "message": "An error occurred when fetching the forum"
+                                               }
+                                       ]
+                               },
+                               "matchingRules": {
+                                       "$.body.errors": {
+                                               "min": 1
+                                       },
+                                       "$.body.errors[*].*": {
+                                               "match": "type"
+                                       },
+                                       "$.body.errors[*].message": {
+                                               "match": "type"
+                                       }
+                               }
+                       }
+               },
+               {
+                       "description": "a request to get a single topic",
+                       "providerState": "there's data",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetTopic",
+                                       "query": "query GetTopic($id: ID!) {\n              topic(id: $id) {\n                id\n                title\n                updated_at\n                ttl\n                forum {\n                  id\n                  glyph\n                  label\n                  __typename\n                }\n                tags {\n                  id\n                  weight\n                  __typename\n                }\n                posts {\n                  id\n                  text\n                  created_at\n                  author {\n                    id\n                    handle\n                    __typename\n                  }\n                  __typename\n                }\n                __typename\n              }\n            }",
+                                       "variables": {
+                                               "id": "0b58959d-d448-4a4e-84b6-35e5ac0028d1"
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetTopic\\(\\$id:\\s*ID!\\)\\s*\\{\\s*topic\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*forum\\s*\\{\\s*id\\s*glyph\\s*label\\s*__typename\\s*\\}\\s*tags\\s*\\{\\s*id\\s*weight\\s*__typename\\s*\\}\\s*posts\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 200,
+                               "headers": {
+                                       "Content-Type": "application/json; charset=utf-8"
+                               },
+                               "body": {
+                                       "data": {
+                                               "topic": {
+                                                       "id": "0b58959d-d448-4a4e-84b6-35e5ac0028d1",
+                                                       "title": "The pacty topic of the day",
+                                                       "updated_at": 1619979888906,
+                                                       "ttl": 3399,
+                                                       "forum": {
+                                                               "id": "cucumber",
+                                                               "glyph": "✽",
+                                                               "label": "test_forums.cucumber"
+                                                       },
+                                                       "tags": [
+                                                               {
+                                                                       "id": "skunk",
+                                                                       "weight": 44
+                                                               }
+                                                       ],
+                                                       "posts": [
+                                                               {
+                                                                       "id": "ed93530e-6f9c-4701-91ef-14f9e0ed3e26",
+                                                                       "text": "The content of this post is very relevant",
+                                                                       "created_at": 1619979889798,
+                                                                       "author": {
+                                                                               "id": "07fb2ba0-0945-464a-b215-873296710c8c",
+                                                                               "handle": "cucumber_fan92"
+                                                                       }
+                                                               }
+                                                       ]
+                                               }
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.data.topic.id": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.topic.title": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.topic.updated_at": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.topic.ttl": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.topic.forum.id": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.topic.forum.glyph": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.topic.forum.label": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.topic.tags": {
+                                               "min": 1
+                                       },
+                                       "$.body.data.topic.tags[*].*": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.topic.tags[*].id": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.topic.tags[*].weight": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.topic.posts": {
+                                               "min": 1
+                                       },
+                                       "$.body.data.topic.posts[*].*": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.topic.posts[*].id": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.topic.posts[*].text": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.topic.posts[*].created_at": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.topic.posts[*].author": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.topic.posts[*].author.id": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.topic.posts[*].author.handle": {
+                                               "match": "type"
+                                       }
+                               }
+                       }
+               },
+               {
+                       "description": "a request to get a single topic",
+                       "providerState": "there's no data",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetTopic",
+                                       "query": "query GetTopic($id: ID!) {\n              topic(id: $id) {\n                id\n                title\n                updated_at\n                ttl\n                forum {\n                  id\n                  glyph\n                  label\n                  __typename\n                }\n                tags {\n                  id\n                  weight\n                  __typename\n                }\n                posts {\n                  id\n                  text\n                  created_at\n                  author {\n                    id\n                    handle\n                    __typename\n                  }\n                  __typename\n                }\n                __typename\n              }\n            }",
+                                       "variables": {
+                                               "id": "0b58959d-d448-4a4e-84b6-35e5ac0028d1"
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetTopic\\(\\$id:\\s*ID!\\)\\s*\\{\\s*topic\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*forum\\s*\\{\\s*id\\s*glyph\\s*label\\s*__typename\\s*\\}\\s*tags\\s*\\{\\s*id\\s*weight\\s*__typename\\s*\\}\\s*posts\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 200,
+                               "headers": {
+                                       "Content-Type": "application/json; charset=utf-8"
+                               },
+                               "body": {
+                                       "data": {
+                                               "topic": null
+                                       }
+                               }
+                       }
+               },
+               {
+                       "description": "a request to get a single topic",
+                       "providerState": "there's a server error",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetTopic",
+                                       "query": "query GetTopic($id: ID!) {\n              topic(id: $id) {\n                id\n                title\n                updated_at\n                ttl\n                forum {\n                  id\n                  glyph\n                  label\n                  __typename\n                }\n                tags {\n                  id\n                  weight\n                  __typename\n                }\n                posts {\n                  id\n                  text\n                  created_at\n                  author {\n                    id\n                    handle\n                    __typename\n                  }\n                  __typename\n                }\n                __typename\n              }\n            }",
+                                       "variables": {
+                                               "id": "0b58959d-d448-4a4e-84b6-35e5ac0028d1"
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetTopic\\(\\$id:\\s*ID!\\)\\s*\\{\\s*topic\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*forum\\s*\\{\\s*id\\s*glyph\\s*label\\s*__typename\\s*\\}\\s*tags\\s*\\{\\s*id\\s*weight\\s*__typename\\s*\\}\\s*posts\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 500,
+                               "headers": {}
+                       }
+               },
+               {
+                       "description": "a request to get a single topic",
+                       "providerState": "there's an error in the response",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetTopic",
+                                       "query": "query GetTopic($id: ID!) {\n              topic(id: $id) {\n                id\n                title\n                updated_at\n                ttl\n                forum {\n                  id\n                  glyph\n                  label\n                  __typename\n                }\n                tags {\n                  id\n                  weight\n                  __typename\n                }\n                posts {\n                  id\n                  text\n                  created_at\n                  author {\n                    id\n                    handle\n                    __typename\n                  }\n                  __typename\n                }\n                __typename\n              }\n            }",
+                                       "variables": {
+                                               "id": "0b58959d-d448-4a4e-84b6-35e5ac0028d1"
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetTopic\\(\\$id:\\s*ID!\\)\\s*\\{\\s*topic\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*forum\\s*\\{\\s*id\\s*glyph\\s*label\\s*__typename\\s*\\}\\s*tags\\s*\\{\\s*id\\s*weight\\s*__typename\\s*\\}\\s*posts\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 200,
+                               "headers": {
+                                       "Content-Type": "application/json; charset=utf-8"
+                               },
+                               "body": {
+                                       "errors": [
+                                               {
+                                                       "message": "An error occurred when fetching the topic"
+                                               }
+                                       ]
+                               },
+                               "matchingRules": {
+                                       "$.body.errors": {
+                                               "min": 1
+                                       },
+                                       "$.body.errors[*].*": {
+                                               "match": "type"
+                                       },
+                                       "$.body.errors[*].message": {
+                                               "match": "type"
+                                       }
+                               }
+                       }
+               },
+               {
+                       "description": "a request to get a single tag",
+                       "providerState": "there's data",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetTag",
+                                       "query": "query GetTag($id: ID!) {\n              tag(id: $id) {\n                id\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
+                                       "variables": {
+                                               "id": "pineapple"
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetTag\\(\\$id:\\s*ID!\\)\\s*\\{\\s*tag\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 200,
+                               "headers": {
+                                       "Content-Type": "application/json; charset=utf-8"
+                               },
+                               "body": {
+                                       "data": {
+                                               "tag": {
+                                                       "id": "pineapple",
+                                                       "topics": [
+                                                               {
+                                                                       "id": "cd038ae7-e8b4-4e38-9543-3d697e69ac34",
+                                                                       "title": "This topic is about pineapples",
+                                                                       "updated_at": 1619978944077,
+                                                                       "ttl": 3555
+                                                               }
+                                                       ]
+                                               }
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.data.tag.id": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.tag.topics": {
+                                               "min": 1
+                                       },
+                                       "$.body.data.tag.topics[*].*": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.tag.topics[*].id": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.tag.topics[*].title": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.tag.topics[*].updated_at": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.tag.topics[*].ttl": {
+                                               "match": "type"
+                                       }
+                               }
+                       }
+               },
+               {
+                       "description": "a request to get a single tag",
+                       "providerState": "there's no data",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetTag",
+                                       "query": "query GetTag($id: ID!) {\n              tag(id: $id) {\n                id\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
+                                       "variables": {
+                                               "id": "pineapple"
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetTag\\(\\$id:\\s*ID!\\)\\s*\\{\\s*tag\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 200,
+                               "headers": {
+                                       "Content-Type": "application/json; charset=utf-8"
+                               },
+                               "body": {
+                                       "data": {
+                                               "tag": null
+                                       }
+                               }
+                       }
+               },
+               {
+                       "description": "a request to get a single tag",
+                       "providerState": "there's a server error",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetTag",
+                                       "query": "query GetTag($id: ID!) {\n              tag(id: $id) {\n                id\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
+                                       "variables": {
+                                               "id": "pineapple"
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetTag\\(\\$id:\\s*ID!\\)\\s*\\{\\s*tag\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 500,
+                               "headers": {}
+                       }
+               },
+               {
+                       "description": "a request to get a single tag",
+                       "providerState": "there's an error in the response",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetTag",
+                                       "query": "query GetTag($id: ID!) {\n              tag(id: $id) {\n                id\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
+                                       "variables": {
+                                               "id": "pineapple"
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetTag\\(\\$id:\\s*ID!\\)\\s*\\{\\s*tag\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 200,
+                               "headers": {
+                                       "Content-Type": "application/json; charset=utf-8"
+                               },
+                               "body": {
+                                       "errors": [
+                                               {
+                                                       "message": "An error occurred when fetching the tag"
+                                               }
+                                       ]
+                               },
+                               "matchingRules": {
+                                       "$.body.errors": {
+                                               "min": 1
+                                       },
+                                       "$.body.errors[*].*": {
+                                               "match": "type"
+                                       },
+                                       "$.body.errors[*].message": {
+                                               "match": "type"
+                                       }
+                               }
+                       }
+               },
+               {
+                       "description": "a request to get a single post",
+                       "providerState": "there's data",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetPost",
+                                       "query": "query GetPost($id: ID!) {\n              post(id: $id) {\n                id\n                text\n                created_at\n                author {\n                  id\n                  handle\n                  __typename\n                }\n                topic {\n                  id\n                  title\n                  __typename\n                }\n                __typename\n              }\n            }",
+                                       "variables": {
+                                               "id": "8f75eba5-6989-4dd3-b466-e464546ce374"
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetPost\\(\\$id:\\s*ID!\\)\\s*\\{\\s*post\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*topic\\s*\\{\\s*id\\s*title\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 200,
+                               "headers": {
+                                       "Content-Type": "application/json; charset=utf-8"
+                               },
+                               "body": {
+                                       "data": {
+                                               "post": {
+                                                       "id": "8f75eba5-6989-4dd3-b466-e464546ce374",
+                                                       "text": "This is a very pacty post",
+                                                       "created_at": 1619976194937,
+                                                       "author": {
+                                                               "id": "a805b3de-cac4-451c-a1e6-f078869c9db9",
+                                                               "handle": "pacts_person"
+                                                       },
+                                                       "topic": {
+                                                               "id": "5c283ce1-0470-4b98-86f5-1fec9a22c9ac",
+                                                               "title": "The parent pacts topic"
+                                                       }
+                                               }
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.data.post": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.post.id": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.post.text": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.post.created_at": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.post.author": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.post.author.id": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.post.author.handle": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.post.topic": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.post.topic.id": {
+                                               "match": "type"
+                                       },
+                                       "$.body.data.post.topic.title": {
+                                               "match": "type"
+                                       }
+                               }
+                       }
+               },
+               {
+                       "description": "a request to get a single post",
+                       "providerState": "there's no data",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetPost",
+                                       "query": "query GetPost($id: ID!) {\n              post(id: $id) {\n                id\n                text\n                created_at\n                author {\n                  id\n                  handle\n                  __typename\n                }\n                topic {\n                  id\n                  title\n                  __typename\n                }\n                __typename\n              }\n            }",
+                                       "variables": {
+                                               "id": "8f75eba5-6989-4dd3-b466-e464546ce374"
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetPost\\(\\$id:\\s*ID!\\)\\s*\\{\\s*post\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*topic\\s*\\{\\s*id\\s*title\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 200,
+                               "headers": {
+                                       "Content-Type": "application/json; charset=utf-8"
+                               },
+                               "body": {
+                                       "data": {
+                                               "post": null
+                                       }
+                               }
+                       }
+               },
+               {
+                       "description": "a request to get a single post",
+                       "providerState": "there's a server error",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetPost",
+                                       "query": "query GetPost($id: ID!) {\n              post(id: $id) {\n                id\n                text\n                created_at\n                author {\n                  id\n                  handle\n                  __typename\n                }\n                topic {\n                  id\n                  title\n                  __typename\n                }\n                __typename\n              }\n            }",
+                                       "variables": {
+                                               "id": "8f75eba5-6989-4dd3-b466-e464546ce374"
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetPost\\(\\$id:\\s*ID!\\)\\s*\\{\\s*post\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*topic\\s*\\{\\s*id\\s*title\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 500,
+                               "headers": {}
+                       }
+               },
+               {
+                       "description": "a request to get a single post",
+                       "providerState": "there's an error in the response",
+                       "request": {
+                               "method": "POST",
+                               "path": "/graphql",
+                               "headers": {
+                                       "content-type": "application/json"
+                               },
+                               "body": {
+                                       "operationName": "GetPost",
+                                       "query": "query GetPost($id: ID!) {\n              post(id: $id) {\n                id\n                text\n                created_at\n                author {\n                  id\n                  handle\n                  __typename\n                }\n                topic {\n                  id\n                  title\n                  __typename\n                }\n                __typename\n              }\n            }",
+                                       "variables": {
+                                               "id": "8f75eba5-6989-4dd3-b466-e464546ce374"
+                                       }
+                               },
+                               "matchingRules": {
+                                       "$.body.query": {
+                                               "match": "regex",
+                                               "regex": "query\\s*GetPost\\(\\$id:\\s*ID!\\)\\s*\\{\\s*post\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*topic\\s*\\{\\s*id\\s*title\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
+                                       }
+                               }
+                       },
+                       "response": {
+                               "status": 200,
+                               "headers": {
+                                       "Content-Type": "application/json; charset=utf-8"
+                               },
+                               "body": {
+                                       "errors": [
+                                               {
+                                                       "message": "An error occurred when fetching the post"
+                                               }
+                                       ]
+                               },
+                               "matchingRules": {
+                                       "$.body.errors": {
+                                               "min": 1
+                                       },
+                                       "$.body.errors[*].*": {
+                                               "match": "type"
+                                       },
+                                       "$.body.errors[*].message": {
+                                               "match": "type"
+                                       }
+                               }
+                       }
+               }
+       ],
+       "metadata": {
+               "pactSpecification": {
+                       "version": "2.0.0"
+               }
+       }
+}
index 33ad091d26d8a9dc95ebdf616e217d985ec215b8..054c147cbf4a4e53873924b7120b5415853b1ed6 100644 (file)
@@ -1,6 +1,6 @@
 module.exports = {
-  plugins: {
-    tailwindcss: {},
-    autoprefixer: {},
-  },
-}
+       plugins: {
+               tailwindcss: {},
+               autoprefixer: {}
+       }
+};
index 32dc872c980c443a1656180919b90c8b8b9c426a..b4d9f338406486ee54f2afaf248aac8b0c09f1ac 100644 (file)
@@ -6,102 +6,88 @@ import { blink } from './blink';
 import { sineOut } from 'svelte/easing';
 
 const internals = {
-  response: null
+       response: null
 };
 
 describe('blink', () => {
-
-  test('it has a default delay of 0ms', () => {
-
-    const response = blink(document.createElement('div'), {});
-
-    expect(response.delay).toBe(0);
-  });
-
-  test('it allows delay to be overridden', () => {
-
-    const response = blink(document.createElement('div'), {
-      delay: 300
-    });
-
-    expect(response.delay).toBe(300);
-  });
-
-  test('it has a default duration of 400ms', () => {
-
-    const response = blink(document.createElement('div'), {});
-
-    expect(response.duration).toBe(400);
-  });
-
-  test('it allows delay to be overridden', () => {
-
-    const response = blink(document.createElement('div'), {
-      duration: 999
-    });
-
-    expect(response.duration).toBe(999);
-  });
-
-  test('it uses sineOut as the default easing function', () => {
-
-    const response = blink(document.createElement('div'), {});
-
-    expect(response.easing).toBe(sineOut);
-  });
-
-  test('it allows easing function to be overridden', () => {
-
-    const response = blink(document.createElement('div'), {
-      easing: () => 666
-    });
-
-    expect(response.easing(0)).toBe(666);
-  });
-
-  describe('css animation function', () => {
-
-    beforeEach(() => {
-
-      const div = document.createElement('div');
-      div.style.width = '100px';
-      div.style.height = '200px';
-      internals.response = blink(div, {});
-    });
-
-    test('It starts with with zeroed width and height', () => {
-
-      const css = internals.response.css(0, 1);
-      expect(css).toContain('width: 0px');
-      expect(css).toContain('height: 0px');
-    });
-
-    test('It grows to full height and 0 width in first 20%', () => {
-
-      const css = internals.response.css(0.2, 0.8);
-      expect(css).toContain('width: 0px');
-      expect(css).toContain('height: 200px');
-    });
-
-    test('It expands to full height by the end', () => {
-
-      const css = internals.response.css(1, 0);
-      expect(css).toContain('width: 100px');
-      expect(css).toContain('height: 200px');
-    });
-
-    test('It keeps element vertically centered by adjusting the margin', () => {
-
-      const css = internals.response.css(0.1, 0.9);
-      expect(css).toContain('margin: 50px 50px');
-      expect(css).toContain('height: 100px');
-    });
-
-    test('It keeps element horizontally centered by adjusting the margin', () => {
-
-      const css = internals.response.css(0.6, 0.4);
-      expect(css).toContain('margin: 0px 25px');
-      expect(css).toContain('width: 50px');
-    });
-  });
+       test('it has a default delay of 0ms', () => {
+               const response = blink(document.createElement('div'), {});
+
+               expect(response.delay).toBe(0);
+       });
+
+       test('it allows delay to be overridden', () => {
+               const response = blink(document.createElement('div'), {
+                       delay: 300
+               });
+
+               expect(response.delay).toBe(300);
+       });
+
+       test('it has a default duration of 400ms', () => {
+               const response = blink(document.createElement('div'), {});
+
+               expect(response.duration).toBe(400);
+       });
+
+       test('it allows delay to be overridden', () => {
+               const response = blink(document.createElement('div'), {
+                       duration: 999
+               });
+
+               expect(response.duration).toBe(999);
+       });
+
+       test('it uses sineOut as the default easing function', () => {
+               const response = blink(document.createElement('div'), {});
+
+               expect(response.easing).toBe(sineOut);
+       });
+
+       test('it allows easing function to be overridden', () => {
+               const response = blink(document.createElement('div'), {
+                       easing: () => 666
+               });
+
+               expect(response.easing(0)).toBe(666);
+       });
+
+       describe('css animation function', () => {
+               beforeEach(() => {
+                       const div = document.createElement('div');
+                       div.style.width = '100px';
+                       div.style.height = '200px';
+                       internals.response = blink(div, {});
+               });
+
+               test('It starts with with zeroed width and height', () => {
+                       const css = internals.response.css(0, 1);
+                       expect(css).toContain('width: 0px');
+                       expect(css).toContain('height: 0px');
+               });
+
+               test('It grows to full height and 0 width in first 20%', () => {
+                       const css = internals.response.css(0.2, 0.8);
+                       expect(css).toContain('width: 0px');
+                       expect(css).toContain('height: 200px');
+               });
+
+               test('It expands to full height by the end', () => {
+                       const css = internals.response.css(1, 0);
+                       expect(css).toContain('width: 100px');
+                       expect(css).toContain('height: 200px');
+               });
+
+               test('It keeps element vertically centered by adjusting the margin', () => {
+                       const css = internals.response.css(0.1, 0.9);
+                       expect(css).toContain('margin: 50px 50px');
+                       expect(css).toContain('height: 100px');
+               });
+
+               test('It keeps element horizontally centered by adjusting the margin', () => {
+                       const css = internals.response.css(0.6, 0.4);
+                       expect(css).toContain('margin: 0px 25px');
+                       expect(css).toContain('width: 50px');
+               });
+       });
 });
index c291b06134a14ed63ed1344ae529dffd245aa9c5..623489a282c92e089d73568ad3a6513b875babf1 100644 (file)
@@ -1,25 +1,23 @@
 import { sineOut } from 'svelte/easing';
 import type { AnimationConfig } from 'svelte/animate';
 
-export const blink = function blink(node: HTMLElement, params: AnimationConfig): AnimationConfig{
+export const blink = function blink(node: HTMLElement, params: AnimationConfig): AnimationConfig {
+       const originalWidth = parseFloat(getComputedStyle(node).width);
+       const originalHeight = parseFloat(getComputedStyle(node).height);
 
-  const originalWidth = parseFloat(getComputedStyle(node).width);
-  const originalHeight = parseFloat(getComputedStyle(node).height);
+       return {
+               delay: params.delay || 0,
+               duration: params.duration || 400,
+               easing: params.easing || sineOut,
+               css: (t: number): string => {
+                       const halfWidth = originalWidth / 2;
+                       const halfHeight = originalHeight / 2;
+                       const height = Math.round(t <= 0.2 ? (originalHeight * t) / 0.2 : originalHeight);
+                       const marginY = Math.round(t <= 0.2 ? halfHeight * (1 - t / 0.2) : 0);
+                       const width = Math.round(t > 0.2 ? ((t - 0.2) / 0.8) * originalWidth : 0);
+                       const marginX = Math.round(t > 0.2 ? (1 - (t - 0.2) / 0.8) * halfWidth : halfWidth);
 
-  return {
-    delay: params.delay || 0,
-    duration: params.duration || 400,
-    easing: params.easing || sineOut,
-    css: (t: number): string => {
-
-      const halfWidth = originalWidth / 2;
-      const halfHeight = originalHeight / 2;
-      const height = Math.round(t <= 0.2 ? (originalHeight * t) / 0.2 : originalHeight);
-      const marginY = Math.round(t <= 0.2 ? halfHeight * (1 - t / 0.2) : 0);
-      const width = Math.round(t > 0.2 ? ((t - 0.2) / 0.8) * originalWidth : 0);
-      const marginX = Math.round(t > 0.2 ? (1 - (t - 0.2) / 0.8) * halfWidth : halfWidth);
-
-      return `width: ${width}px; height: ${height}px; margin: ${marginY}px ${marginX}px`;
-    }
-  };
+                       return `width: ${width}px; height: ${height}px; margin: ${marginY}px ${marginX}px`;
+               }
+       };
 };
index 1311d0680d0c72f944c23802bfb740767b59b85f..a3cba3b7e92186419b4a5ecb53894773d073b383 100644 (file)
@@ -1,14 +1,14 @@
 <script lang="ts">
-  import type { TopicAction } from '$lib/stores/action';
+       import type { TopicAction } from '$lib/stores/action';
        export let actions: TopicAction;
 
        import { _ } from 'svelte-i18n';
 </script>
 
 <li>
-  <a href="/reply/{actions.id}" title={$_('header.action.reply.title')}>
-    {@html $_('header.action.reply.display')}
-  </a>
+       <a href="/reply/{actions.id}" title={$_('header.action.reply.title')}>
+               {@html $_('header.action.reply.display')}
+       </a>
 </li>
 
 <style>
index 0037a7f8b0506d969a5abc91c41d0bec755be4fa..9a17d3823288481b0f7aa8c2828bc79c6a0c79b6 100644 (file)
@@ -9,21 +9,19 @@ import '$lib/i18n';
 
 import Topic from './topic.svelte';
 
-const internals = {
-  results: null
-};
-
 describe('Topic Actions component', () => {
-
-  test('Should link to reply page', () => {
-
-    const results = render(Topic, { props: {
-      actions: {
-        id: '8ebaa211-fd9b-423a-8b4f-b57622007fde'
-      }
-    } });
-
-    expect(results.getByTitle('Reply').closest('a'))
-      .toHaveAttribute('href', '/reply/8ebaa211-fd9b-423a-8b4f-b57622007fde');
-  });
+       test('Should link to reply page', () => {
+               const results = render(Topic, {
+                       props: {
+                               actions: {
+                                       id: '8ebaa211-fd9b-423a-8b4f-b57622007fde'
+                               }
+                       }
+               });
+
+               expect(results.getByTitle('Reply').closest('a')).toHaveAttribute(
+                       'href',
+                       '/reply/8ebaa211-fd9b-423a-8b4f-b57622007fde'
+               );
+       });
 });
index d2ac4583159dee7d9b49dd411edd52a49597b7a5..401874f61b155f8861b54a06c6214e28b2e6c9c3 100644 (file)
@@ -10,23 +10,19 @@ import '$lib/i18n';
 import ErrorBlock from './error_block.svelte';
 
 describe('Error Block component', () => {
+       test('Should display error message sent', () => {
+               const results = render(ErrorBlock, {
+                       props: {
+                               message: 'An error has, sadly, destroyed everything.'
+                       }
+               });
 
-  test('Should display error message sent', () => {
+               expect(results.getByText('An error has, sadly, destroyed everything.')).toBeVisible();
+       });
 
-    const results = render(ErrorBlock, { props: {
-      message: 'An error has, sadly, destroyed everything.'
-    } });
+       test('Should display default error message', () => {
+               const results = render(ErrorBlock);
 
-    expect(results.getByText('An error has, sadly, destroyed everything.'))
-      .toBeVisible();
-  });
-
-  test('Should display default error message', () => {
-
-    const results = render(ErrorBlock);
-
-    expect(results.getByText('Unknown error has occurred. Panic!'))
-      .toBeVisible();
-  });
+               expect(results.getByText('Unknown error has occurred. Panic!')).toBeVisible();
+       });
 });
-
index b3ce1670c9acd85df707bfd9435baaa7d8d8ee71..61a70e19c0c2307b910431f3f9bee9797aa74483 100644 (file)
@@ -12,62 +12,59 @@ import '$lib/i18n';
 import Forum from './forum.svelte';
 
 const internals = {
-  results: null
+       results: null
 };
 
 describe('Forum component', () => {
-
-  beforeAll(() => {
-
-    addMessages('en', {
-      'test_forums.oleo': 'Oleo'
-    });
-  });
-
-  beforeEach(() => {
-
-    internals.results = render(Forum, { props: {
-      forum: {
-        id: 'oleo',
-        glyph: '☽',
-        label: 'test_forums.oleo',
-        topics: [
-          {
-            id: '0575d375-5bea-44df-a597-bee3adda624d',
-            title: 'Very forumy topic',
-            ttl: 160 * 1000,
-            updated_at: Date.now()
-          },
-          {
-            id: 'aeeb56e4-751d-4400-8aa7-d0f3a20d4e25',
-            title: 'Only mildly forum-like',
-            ttl: 160 * 1000,
-            updated_at: Date.now()
-          }
-        ]
-      }
-    } });
-  });
-
-  test('It should display the forum glyph and label', () => {
-
-    expect(internals.results.getByText(/^\s*☽\s*Oleo\s*$/))
-      .toBeVisible();
-  });
-
-  test('It should display the topics', () => {
-
-    expect(internals.results.getByText('Very forumy topic'))
-      .toBeVisible();
-    expect(internals.results.getByText('Only mildly forum-like'))
-      .toBeVisible();
-  });
-
-  test('It should link to the topics', () => {
-
-    expect(internals.results.getByText('Very forumy topic').closest('a'))
-      .toHaveAttribute('href', '/t/0575d375-5bea-44df-a597-bee3adda624d');
-    expect(internals.results.getByText('Only mildly forum-like').closest('a'))
-      .toHaveAttribute('href', '/t/aeeb56e4-751d-4400-8aa7-d0f3a20d4e25');
-  });
+       beforeAll(() => {
+               addMessages('en', {
+                       'test_forums.oleo': 'Oleo'
+               });
+       });
+
+       beforeEach(() => {
+               internals.results = render(Forum, {
+                       props: {
+                               forum: {
+                                       id: 'oleo',
+                                       glyph: '☽',
+                                       label: 'test_forums.oleo',
+                                       topics: [
+                                               {
+                                                       id: '0575d375-5bea-44df-a597-bee3adda624d',
+                                                       title: 'Very forumy topic',
+                                                       ttl: 160 * 1000,
+                                                       updated_at: Date.now()
+                                               },
+                                               {
+                                                       id: 'aeeb56e4-751d-4400-8aa7-d0f3a20d4e25',
+                                                       title: 'Only mildly forum-like',
+                                                       ttl: 160 * 1000,
+                                                       updated_at: Date.now()
+                                               }
+                                       ]
+                               }
+                       }
+               });
+       });
+
+       test('It should display the forum glyph and label', () => {
+               expect(internals.results.getByText(/^\s*☽\s*Oleo\s*$/)).toBeVisible();
+       });
+
+       test('It should display the topics', () => {
+               expect(internals.results.getByText('Very forumy topic')).toBeVisible();
+               expect(internals.results.getByText('Only mildly forum-like')).toBeVisible();
+       });
+
+       test('It should link to the topics', () => {
+               expect(internals.results.getByText('Very forumy topic').closest('a')).toHaveAttribute(
+                       'href',
+                       '/t/0575d375-5bea-44df-a597-bee3adda624d'
+               );
+               expect(internals.results.getByText('Only mildly forum-like').closest('a')).toHaveAttribute(
+                       'href',
+                       '/t/aeeb56e4-751d-4400-8aa7-d0f3a20d4e25'
+               );
+       });
 });
index 3529de81ca5e83137fee4e1e8ebe9cd2d0c4ecb5..81a5e4f8de5693037ea8076d30369fdfcf1900d0 100644 (file)
@@ -1,19 +1,19 @@
 <script lang="ts">
-  import { _ } from 'svelte-i18n';
-  export let forums;
+       import { _ } from 'svelte-i18n';
+       export let forums;
 
-  $: sortedForums = forums.slice().sort((a, b) => a.position - b.position);
+       $: sortedForums = forums.slice().sort((a, b) => a.position - b.position);
 </script>
 
 <ul>
-  {#each sortedForums as forum}
-    <li>
-      <a href="/f/{forum.id}">
-        <span aria-hidden="true" class="navigation-glyph {forum.glyph}">{forum.glyph}</span>
-        <span class="navigation-label">{$_(forum.label)}</span>
-      </a>
-    </li>
-  {/each}
+       {#each sortedForums as forum}
+               <li>
+                       <a href="/f/{forum.id}">
+                               <span aria-hidden="true" class="navigation-glyph {forum.glyph}">{forum.glyph}</span>
+                               <span class="navigation-label">{$_(forum.label)}</span>
+                       </a>
+               </li>
+       {/each}
 </ul>
 
 <style>
index be7d44907af8e3e85636ec4fb4429367c3f1fb9f..1670b5c09b39b4c99610fcb86d2abd489068182b 100644 (file)
@@ -12,83 +12,79 @@ import { addMessages } from 'svelte-i18n';
 import ForumList from './forum_list.svelte';
 
 const internals = {
-  results: null
+       results: null
 };
 
 describe('Forum List component', () => {
-
-  beforeAll(() => {
-
-    addMessages('en', {
-      'test_forums.yes': 'Absolutely yes',
-      'test_forums.no': 'No, not at all',
-      'test_forums.maybe': 'OK, maybe...'
-    });
-  });
-
-  beforeEach(() => {
-
-    internals.results = render(ForumList, { props: {
-      forums: [
-        {
-          id: 'yes',
-          glyph: '☆',
-          label: 'test_forums.yes',
-          position: 2
-        },
-        {
-          id: 'no',
-          glyph: '◯',
-          label: 'test_forums.no',
-          position: 0
-        },
-        {
-          id: 'maybe',
-          glyph: '⏀',
-          label: 'test_forums.maybe',
-          position: 1
-        }
-      ]
-    } });
-  });
-
-  test('It should display each forum according to their position', () => {
-
-    expect(internals.results.container)
-      .toHaveTextContent(/^◯.+⏀.+☆.+$/);
-  });
-
-  test('It should translate forum labels', () => {
-
-    expect(internals.results.getByText('Absolutely yes')).toBeVisible();
-    expect(internals.results.getByText('No, not at all')).toBeVisible();
-    expect(internals.results.getByText('OK, maybe...')).toBeVisible();
-  });
-
-  test('It should display forum glyphs', () => {
-
-    expect(internals.results.getByText('☆')).toBeVisible();
-    expect(internals.results.getByText('◯')).toBeVisible();
-    expect(internals.results.getByText('⏀')).toBeVisible();
-  });
-
-  test('Label should be a permalink to the forum', () => {
-
-    expect(internals.results.getByText('Absolutely yes').closest('a'))
-      .toHaveAttribute('href', '/f/yes');
-    expect(internals.results.getByText('No, not at all').closest('a'))
-      .toHaveAttribute('href', '/f/no');
-    expect(internals.results.getByText('OK, maybe...').closest('a'))
-      .toHaveAttribute('href', '/f/maybe');
-  });
-
-  test('Glyph should be a permalink to the forum', () => {
-
-    expect(internals.results.getByText('☆').closest('a'))
-      .toHaveAttribute('href', '/f/yes');
-    expect(internals.results.getByText('◯').closest('a'))
-      .toHaveAttribute('href', '/f/no');
-    expect(internals.results.getByText('⏀').closest('a'))
-      .toHaveAttribute('href', '/f/maybe');
-  });
+       beforeAll(() => {
+               addMessages('en', {
+                       'test_forums.yes': 'Absolutely yes',
+                       'test_forums.no': 'No, not at all',
+                       'test_forums.maybe': 'OK, maybe...'
+               });
+       });
+
+       beforeEach(() => {
+               internals.results = render(ForumList, {
+                       props: {
+                               forums: [
+                                       {
+                                               id: 'yes',
+                                               glyph: '☆',
+                                               label: 'test_forums.yes',
+                                               position: 2
+                                       },
+                                       {
+                                               id: 'no',
+                                               glyph: '◯',
+                                               label: 'test_forums.no',
+                                               position: 0
+                                       },
+                                       {
+                                               id: 'maybe',
+                                               glyph: '⏀',
+                                               label: 'test_forums.maybe',
+                                               position: 1
+                                       }
+                               ]
+                       }
+               });
+       });
+
+       test('It should display each forum according to their position', () => {
+               expect(internals.results.container).toHaveTextContent(/^◯.+⏀.+☆.+$/);
+       });
+
+       test('It should translate forum labels', () => {
+               expect(internals.results.getByText('Absolutely yes')).toBeVisible();
+               expect(internals.results.getByText('No, not at all')).toBeVisible();
+               expect(internals.results.getByText('OK, maybe...')).toBeVisible();
+       });
+
+       test('It should display forum glyphs', () => {
+               expect(internals.results.getByText('☆')).toBeVisible();
+               expect(internals.results.getByText('◯')).toBeVisible();
+               expect(internals.results.getByText('⏀')).toBeVisible();
+       });
+
+       test('Label should be a permalink to the forum', () => {
+               expect(internals.results.getByText('Absolutely yes').closest('a')).toHaveAttribute(
+                       'href',
+                       '/f/yes'
+               );
+               expect(internals.results.getByText('No, not at all').closest('a')).toHaveAttribute(
+                       'href',
+                       '/f/no'
+               );
+               expect(internals.results.getByText('OK, maybe...').closest('a')).toHaveAttribute(
+                       'href',
+                       '/f/maybe'
+               );
+       });
+
+       test('Glyph should be a permalink to the forum', () => {
+               expect(internals.results.getByText('☆').closest('a')).toHaveAttribute('href', '/f/yes');
+               expect(internals.results.getByText('◯').closest('a')).toHaveAttribute('href', '/f/no');
+               expect(internals.results.getByText('⏀').closest('a')).toHaveAttribute('href', '/f/maybe');
+       });
 });
index 778353f8eb0b1fe8184c3d51f137f8a9ad34785b..a4a7470f9eedaeed7dc6277b51cd9b297c936f9c 100644 (file)
@@ -10,27 +10,23 @@ import '$lib/i18n';
 import Glyph from './glyph.svelte';
 
 const internals = {
-  results: null
+       results: null
 };
 
 describe('Glyph component', () => {
-
-  beforeEach(() => {
-
-    internals.results = render(Glyph, { props: {
-      uuid: '9fb14ebc-bc64-400b-915f-d429ec44b8fe'
-    } });
-  });
-
-  test('Should act as an image', () => {
-
-    expect(internals.results.getByRole('img'))
-      .toBeVisible();
-  });
-
-  test('Should render 4 glyphs', () => {
-
-    expect(internals.results.getByRole('img'))
-      .toHaveTextContent(/^. . . .$/);
-  });
+       beforeEach(() => {
+               internals.results = render(Glyph, {
+                       props: {
+                               uuid: '9fb14ebc-bc64-400b-915f-d429ec44b8fe'
+                       }
+               });
+       });
+
+       test('Should act as an image', () => {
+               expect(internals.results.getByRole('img')).toBeVisible();
+       });
+
+       test('Should render 4 glyphs', () => {
+               expect(internals.results.getByRole('img')).toHaveTextContent(/^. . . .$/);
+       });
 });
index e6c9348f1253ca2c6853489f5095353b429dbb05..51df1c27bd35426e2f68a156ac3569355439e789 100644 (file)
@@ -20,7 +20,7 @@
                        >
                </li>
                {#if $topicActions}
-      <TopicActions actions={$topicActions} />
+                       <TopicActions actions={$topicActions} />
                {/if}
                <li>
                        <a href="/search" title={$_('header.action.search.title')}
index 4107b2dfe1e3471b0e576bbe15911c2eae1bec2e..d7a780163bc5866d66d9cfb3d6a5a3c2d17636f5 100644 (file)
@@ -13,21 +13,16 @@ jest.mock('$lib/config/config.ts');
 import Header from './header.svelte';
 
 describe('Header component', () => {
+       test('Should not display topic if action is not set', () => {
+               const results = render(Header);
 
-  test('Should not display topic if action is not set', () => {
+               expect(results.queryByTitle('Reply')).toBe(null);
+       });
 
-    const results = render(Header);
+       test('Should display topic if action is set', () => {
+               enableTopicActions('d138d6d8-e669-42e7-995d-20a7fcc176f5');
+               const results = render(Header);
 
-    expect(results.queryByTitle('Reply'))
-      .toBe(null);
-  });
-
-  test('Should display topic if action is set', () => {
-
-    enableTopicActions('d138d6d8-e669-42e7-995d-20a7fcc176f5');
-    const results = render(Header);
-
-    expect(results.getByTitle('Reply'))
-      .toBeVisible();
-  });
+               expect(results.getByTitle('Reply')).toBeVisible();
+       });
 });
index 64a4ef9e14fb7ea2187d1bdf2d2b5d0bba42390a..4e245f83d4ceb8b89817d720296ad44222d263d8 100644 (file)
@@ -3,16 +3,16 @@
        import { getLangNameFromCode } from 'language-name-map';
 
        $: namedLocales = $locales
-         .map((code) => ({
-           code,
-           ...getLangNameFromCode(code)
-         }))
-         .sort((a, b) => a.native - b.native);
+               .map((code) => ({
+                       code,
+                       ...getLangNameFromCode(code)
+               }))
+               .sort((a, b) => a.native - b.native);
 
-  let selected = $locale
+       let selected = $locale;
 
        $: {
-         locale.set(selected);
+               locale.set(selected);
        }
 </script>
 
index 74156bc31e291c1eb5fa76b2e968c40195ec014c..673e1e6f347d022098ade7b01b934f46264687ae 100644 (file)
@@ -12,37 +12,28 @@ import '$lib/i18n';
 import LanguageSelector from './language_selector.svelte';
 
 const internals = {
-  results: null
+       results: null
 };
 
 describe('Language Selector component', () => {
-
-  beforeEach(() => {
-
-    internals.results = render(LanguageSelector);
-  });
-
-  test('Should display languages in their own language', () => {
-
-    expect(internals.results.getByText('English'))
-      .toBeVisible();
-    expect(internals.results.getByText('Español'))
-      .toBeVisible();
-  });
-
-  test('Should change locale when a language is selected', async () => {
-
-    locale.subscribe((localeValue) => {
-
-      expect(localeValue).toBe('en');
-    })();
-    const spanish = internals.results.getByText('Español');
-    await userEvent.selectOptions(spanish.closest('select'), spanish);
-    await act();
-    locale.subscribe((localeValue) => {
-
-      expect(localeValue).toBe('es');
-    })();
-  });
+       beforeEach(() => {
+               internals.results = render(LanguageSelector);
+       });
+
+       test('Should display languages in their own language', () => {
+               expect(internals.results.getByText('English')).toBeVisible();
+               expect(internals.results.getByText('Español')).toBeVisible();
+       });
+
+       test('Should change locale when a language is selected', async () => {
+               locale.subscribe((localeValue) => {
+                       expect(localeValue).toBe('en');
+               })();
+               const spanish = internals.results.getByText('Español');
+               await userEvent.selectOptions(spanish.closest('select'), spanish);
+               await act();
+               locale.subscribe((localeValue) => {
+                       expect(localeValue).toBe('es');
+               })();
+       });
 });
-
index 4e6c28ff70b0b3e9a325325103c0e669139007be..d909be1c02936119e6f7a4249517f5f12ac97929 100644 (file)
                        {timestampToISO(post.created_at)}
                </a>
        </time>
-  {#if post.topic}
-  <span>
-    ({$_('post.topic_location')} <a href="/t/{post.topic.id}">{post.topic.title}</a>.)
-  </span>
-  {/if}
+       {#if post.topic}
+               <span>
+                       ({$_('post.topic_location')} <a href="/t/{post.topic.id}">{post.topic.title}</a>.)
+               </span>
+       {/if}
 </aside>
 <article
        class="e-content"
index d43583e8efe7436598bdd347222c0bc3248afe2b..4351f3fa664be6f8cefc2c54245351e8087bf90c 100644 (file)
@@ -10,119 +10,110 @@ import '$lib/i18n';
 import Post from './post.svelte';
 
 const internals = {
-  basicPost: {
-    id: 'e5a19d53-4c9a-4be8-afa5-00942ea3afa4',
-    text: 'This is an example post qwerty',
-    created_at: Date.UTC(2021, 3, 19, 6, 6, 6, 666).valueOf(),
-    author: {
-      handle: 'very_cool_user',
-      id: 'b01bdb48-4b5e-46a4-97f3-6db789bcd33b'
-    },
-    topic: {
-      id: '35d3c3eb-e486-42ef-994c-d8ab1f1e167a',
-      title: 'Parent topic, yes'
-    }
-  },
-  postWithoutTopic: {
-    id: '9e52e38e-9007-4a20-bbf1-cea4e2f950f3',
-    text: 'This is a post without a topic',
-    created_at: Date.UTC(2022, 8, 21, 4, 3, 1, 340).valueOf(),
-    author: {
-      handle: 'my_normal_user',
-      id: '121f8f97-de02-4102-b25d-f34fd619009b'
-    }
-  },
-
-  results: null
+       basicPost: {
+               id: 'e5a19d53-4c9a-4be8-afa5-00942ea3afa4',
+               text: 'This is an example post qwerty',
+               created_at: Date.UTC(2021, 3, 19, 6, 6, 6, 666).valueOf(),
+               author: {
+                       handle: 'very_cool_user',
+                       id: 'b01bdb48-4b5e-46a4-97f3-6db789bcd33b'
+               },
+               topic: {
+                       id: '35d3c3eb-e486-42ef-994c-d8ab1f1e167a',
+                       title: 'Parent topic, yes'
+               }
+       },
+       postWithoutTopic: {
+               id: '9e52e38e-9007-4a20-bbf1-cea4e2f950f3',
+               text: 'This is a post without a topic',
+               created_at: Date.UTC(2022, 8, 21, 4, 3, 1, 340).valueOf(),
+               author: {
+                       handle: 'my_normal_user',
+                       id: '121f8f97-de02-4102-b25d-f34fd619009b'
+               }
+       },
+
+       results: null
 };
 
 describe('Post component', () => {
-
-  beforeEach(() => {
-
-    internals.results = render(Post, { props: {
-      post: internals.basicPost
-    } });
-  });
-
-  test('Should display the text of the post', () => {
-
-    expect(internals.results.getByText('This is an example post qwerty')).toBeVisible();
-  });
-
-  test('Should display date of the post', () => {
-
-    expect(internals.results.getByText('2021-04-19T06:06:06.666Z'))
-      .toBeVisible();
-  });
-
-  test('Date of post should be a permalink to the post', () => {
-
-    expect(internals.results.getByText('2021-04-19T06:06:06.666Z').closest('a'))
-      .toHaveAttribute('href', '/p/e5a19d53-4c9a-4be8-afa5-00942ea3afa4');
-  });
-
-  test('Should display the glyph of the post author', () => {
-
-    const glyphicon = internals.results.getByRole('img');
-
-    expect(glyphicon)
-      .toBeVisible();
-    expect(glyphicon)
-      .toHaveTextContent(/^. . . .$/);
-  });
-
-  test('Should display author handle', () => {
-
-    expect(internals.results.getByText('very_cool_user'))
-      .toBeVisible();
-  });
-
-  test('Author handle should have a permalink to topic', () => {
-
-    expect(internals.results.getByText('very_cool_user').closest('a'))
-      .toHaveAttribute('href', '/a/very_cool_user');
-  });
-
-  test('Should display parent topic title', () => {
-
-    expect(internals.results.getByText('Parent topic, yes'))
-      .toBeVisible();
-  });
-
-  test('Parent topic title should have a permalink to topic', () => {
-
-    expect(internals.results.getByText('Parent topic, yes').closest('a'))
-      .toHaveAttribute('href', '/t/35d3c3eb-e486-42ef-994c-d8ab1f1e167a');
-  });
-
-  test('Parent topic title should have a permalink to topic', () => {
-
-    cleanup();
-    internals.results = render(Post, { props: {
-      post: internals.postWithoutTopic
-    } });
-
-    expect(internals.results.queryByText('Parent topic, yes'))
-      .toBe(null);
-  });
-
-  test('It should default to 1/1 when no index or count is passed', () => {
-
-    expect(internals.results.getByTitle('Post 1 of 1 by very_cool_user'))
-      .toBeVisible();
-  });
-
-  test('Parent topic title should have a permalink to topic', () => {
-
-    cleanup();
-    internals.results = render(Post, { props: {
-      index: 2,
-      count: 5,
-      post: internals.postWithoutTopic
-    } });
-
-    expect(internals.results.getByTitle('Post 3 of 5 by my_normal_user'))
-      .toBeVisible();
-  });
+       beforeEach(() => {
+               internals.results = render(Post, {
+                       props: {
+                               post: internals.basicPost
+                       }
+               });
+       });
+
+       test('Should display the text of the post', () => {
+               expect(internals.results.getByText('This is an example post qwerty')).toBeVisible();
+       });
+
+       test('Should display date of the post', () => {
+               expect(internals.results.getByText('2021-04-19T06:06:06.666Z')).toBeVisible();
+       });
+
+       test('Date of post should be a permalink to the post', () => {
+               expect(internals.results.getByText('2021-04-19T06:06:06.666Z').closest('a')).toHaveAttribute(
+                       'href',
+                       '/p/e5a19d53-4c9a-4be8-afa5-00942ea3afa4'
+               );
+       });
+
+       test('Should display the glyph of the post author', () => {
+               const glyphicon = internals.results.getByRole('img');
+
+               expect(glyphicon).toBeVisible();
+               expect(glyphicon).toHaveTextContent(/^. . . .$/);
+       });
+
+       test('Should display author handle', () => {
+               expect(internals.results.getByText('very_cool_user')).toBeVisible();
+       });
+
+       test('Author handle should have a permalink to topic', () => {
+               expect(internals.results.getByText('very_cool_user').closest('a')).toHaveAttribute(
+                       'href',
+                       '/a/very_cool_user'
+               );
+       });
+
+       test('Should display parent topic title', () => {
+               expect(internals.results.getByText('Parent topic, yes')).toBeVisible();
+       });
+
+       test('Parent topic title should have a permalink to topic', () => {
+               expect(internals.results.getByText('Parent topic, yes').closest('a')).toHaveAttribute(
+                       'href',
+                       '/t/35d3c3eb-e486-42ef-994c-d8ab1f1e167a'
+               );
+       });
+
+       test('Parent topic title should have a permalink to topic', () => {
+               cleanup();
+               internals.results = render(Post, {
+                       props: {
+                               post: internals.postWithoutTopic
+                       }
+               });
+
+               expect(internals.results.queryByText('Parent topic, yes')).toBe(null);
+       });
+
+       test('It should default to 1/1 when no index or count is passed', () => {
+               expect(internals.results.getByTitle('Post 1 of 1 by very_cool_user')).toBeVisible();
+       });
+
+       test('Parent topic title should have a permalink to topic', () => {
+               cleanup();
+               internals.results = render(Post, {
+                       props: {
+                               index: 2,
+                               count: 5,
+                               post: internals.postWithoutTopic
+                       }
+               });
+
+               expect(internals.results.getByTitle('Post 3 of 5 by my_normal_user')).toBeVisible();
+       });
 });
index 76304e6f32a5ca3c3c14a473391bbf7895c243cb..9e4564c7830892f1b94bf684cd840f0381616247 100644 (file)
@@ -10,53 +10,51 @@ import '$lib/i18n';
 import Tag from './tag.svelte';
 
 const internals = {
-  results: null
+       results: null
 };
 
 describe('Tag component', () => {
-
-  beforeEach(() => {
-
-    internals.results = render(Tag, { props: {
-      tag: {
-        id: 'avocado',
-        topics: [
-          {
-            id: 'eb751e7a-5777-46c3-b81b-cc66546d5157',
-            title: 'A single topic',
-            ttl: 160 * 1000,
-            updated_at: Date.now()
-          },
-          {
-            id: 'b4a5613c-237b-4147-a867-9c105d51e365',
-            title: 'And its companion',
-            ttl: 160 * 1000,
-            updated_at: Date.now()
-          }
-        ]
-      }
-    } });
-  });
-
-  test('It should display the tag title', () => {
-
-    expect(internals.results.getByText('Tag: avocado'))
-      .toBeVisible();
-  });
-
-  test('It should display the topics', () => {
-
-    expect(internals.results.getByText('A single topic'))
-      .toBeVisible();
-    expect(internals.results.getByText('And its companion'))
-      .toBeVisible();
-  });
-
-  test('It should link to the topics', () => {
-
-    expect(internals.results.getByText('A single topic').closest('a'))
-      .toHaveAttribute('href', '/t/eb751e7a-5777-46c3-b81b-cc66546d5157');
-    expect(internals.results.getByText('And its companion').closest('a'))
-      .toHaveAttribute('href', '/t/b4a5613c-237b-4147-a867-9c105d51e365');
-  });
+       beforeEach(() => {
+               internals.results = render(Tag, {
+                       props: {
+                               tag: {
+                                       id: 'avocado',
+                                       topics: [
+                                               {
+                                                       id: 'eb751e7a-5777-46c3-b81b-cc66546d5157',
+                                                       title: 'A single topic',
+                                                       ttl: 160 * 1000,
+                                                       updated_at: Date.now()
+                                               },
+                                               {
+                                                       id: 'b4a5613c-237b-4147-a867-9c105d51e365',
+                                                       title: 'And its companion',
+                                                       ttl: 160 * 1000,
+                                                       updated_at: Date.now()
+                                               }
+                                       ]
+                               }
+                       }
+               });
+       });
+
+       test('It should display the tag title', () => {
+               expect(internals.results.getByText('Tag: avocado')).toBeVisible();
+       });
+
+       test('It should display the topics', () => {
+               expect(internals.results.getByText('A single topic')).toBeVisible();
+               expect(internals.results.getByText('And its companion')).toBeVisible();
+       });
+
+       test('It should link to the topics', () => {
+               expect(internals.results.getByText('A single topic').closest('a')).toHaveAttribute(
+                       'href',
+                       '/t/eb751e7a-5777-46c3-b81b-cc66546d5157'
+               );
+               expect(internals.results.getByText('And its companion').closest('a')).toHaveAttribute(
+                       'href',
+                       '/t/b4a5613c-237b-4147-a867-9c105d51e365'
+               );
+       });
 });
index 06f2aebb8490fd6e4256fa050df8fc792f6cea93..5b5ed0b3d2ffb54631cc7774d588e7c3e099710b 100644 (file)
        <aside class="topic-meta" title={$_('topic.metadata_title')}>
                {#if topic.forum}
                        <span class="topic-location">
-        {$_('topic.category_location')}
+                               {$_('topic.category_location')}
                                <a href="/f/{topic.forum.id}" class="p-category">
-          {topic.forum.glyph} {$_(topic.forum.label)}
-        </a>.
-      </span>
+                                       {topic.forum.glyph}
+                                       {$_(topic.forum.label)}
+                               </a>.
+                       </span>
                {/if}
                <span class="topic-ttl">
-      <a class="u-url u-uid" title={$_('topic.permalink_title')} href="/t/{topic.id}">
-        ({$_('topic.remaining_time', {
+                       <a class="u-url u-uid" title={$_('topic.permalink_title')} href="/t/{topic.id}">
+                               ({$_('topic.remaining_time', {
                                        values: { remaining: $_(remaining.label, { values: { count: remaining.count } }) }
-        })})
-      </a>.
-    </span>
+                               })})
+                       </a>.
+               </span>
        </aside>
        {#if topic.tags.length > 0}
                <aside class="topic-tags" title={$_('topic.tags_title')}>
                        {$_('topic.tags_location')}
                        {#each topic.tags as tag}
                                <a href="/g/{tag.id}" class="p-category">
-          {tag.id}<span class="tag-weight">({tag.weight})</span>
-        </a>{' '}
+                                       {tag.id}<span class="tag-weight">({tag.weight})</span>
+                               </a>{' '}
                        {/each}
                </aside>
        {/if}
index 985ca72f0c0a5ab83f4b0e89533f96aa96575435..e4c3bad04910aef89c3550caa50874ebd0c2ab2c 100644 (file)
@@ -12,157 +12,139 @@ import '$lib/i18n';
 import Topic from './topic.svelte';
 
 const internals = {
-  results: null,
-  basicTopic: {
-    id: 'b1a4f8d1-4d16-4872-b391-fda6a0e9012d',
-    title: 'I sure am a test topic',
-    ttl: 160 * 1000,
-    updated_at: Date.now(),
-    forum: {
-      id: 'diversion',
-      glyph: '⏃',
-      label: 'test_forums.diversion'
-    },
-    tags: [
-      {
-        id: 'fish',
-        weight: 40
-      },
-      {
-        id: 'statue',
-        weight: 5
-      }
-    ],
-    posts: [
-      {
-        id: '413a74db-9473-4bac-8698-da9452c05854',
-        text: 'This is the first post',
-        created_at: Date.UTC(1999, 7, 1, 8, 8, 2, 111).valueOf(),
-        author: {
-          handle: 'past_user',
-          id: 'c76d3e51-76ac-4e84-a1b2-2eee9abd68b3'
-        }
-      },
-      {
-        id: '821ff177-5250-406f-9431-1a8097b35430',
-        text: 'This response came later',
-        created_at: Date.UTC(2038, 1, 2, 3, 4, 6, 789).valueOf(),
-        author: {
-          handle: 'future_user',
-          id: 'cb9307cb-77e9-4c55-bbe7-dbbf88737358'
-        }
-      }
-    ]
-  },
-  topicWithoutForum: {
-    id: '9715e9ee-0d63-4b50-b613-826ef2791728',
-    title: 'This topic, no forums',
-    ttl: 160 * 1000,
-    updated_at: Date.now(),
-    tags: [
-      {
-        id: 'cauliflower',
-        weight: 33
-      }
-    ],
-    posts: []
-  }
+       results: null,
+       basicTopic: {
+               id: 'b1a4f8d1-4d16-4872-b391-fda6a0e9012d',
+               title: 'I sure am a test topic',
+               ttl: 160 * 1000,
+               updated_at: Date.now(),
+               forum: {
+                       id: 'diversion',
+                       glyph: '⏃',
+                       label: 'test_forums.diversion'
+               },
+               tags: [
+                       {
+                               id: 'fish',
+                               weight: 40
+                       },
+                       {
+                               id: 'statue',
+                               weight: 5
+                       }
+               ],
+               posts: [
+                       {
+                               id: '413a74db-9473-4bac-8698-da9452c05854',
+                               text: 'This is the first post',
+                               created_at: Date.UTC(1999, 7, 1, 8, 8, 2, 111).valueOf(),
+                               author: {
+                                       handle: 'past_user',
+                                       id: 'c76d3e51-76ac-4e84-a1b2-2eee9abd68b3'
+                               }
+                       },
+                       {
+                               id: '821ff177-5250-406f-9431-1a8097b35430',
+                               text: 'This response came later',
+                               created_at: Date.UTC(2038, 1, 2, 3, 4, 6, 789).valueOf(),
+                               author: {
+                                       handle: 'future_user',
+                                       id: 'cb9307cb-77e9-4c55-bbe7-dbbf88737358'
+                               }
+                       }
+               ]
+       },
+       topicWithoutForum: {
+               id: '9715e9ee-0d63-4b50-b613-826ef2791728',
+               title: 'This topic, no forums',
+               ttl: 160 * 1000,
+               updated_at: Date.now(),
+               tags: [
+                       {
+                               id: 'cauliflower',
+                               weight: 33
+                       }
+               ],
+               posts: []
+       }
 };
 
 describe('Topic component', () => {
-
-  beforeAll(() => {
-
-    addMessages('en', {
-      'test_forums.diversion': 'Diversion'
-    });
-  });
-
-  beforeEach(() => {
-
-    internals.results = render(Topic, { props: {
-      topic: internals.basicTopic
-    } });
-  });
-
-  test('Should show the topic title', () => {
-
-    expect(internals.results.getByText('I sure am a test topic'))
-      .toBeVisible();
-  });
-  test('Should display remaining time in readable format', () => {
-
-    expect(internals.results.getByText(/2 minutes remaining/))
-      .toBeVisible();
-  });
-  test('Remaining time should be a permalink to the topic', () => {
-
-    expect(internals.results.getByText(/2 minutes remaining/).closest('a'))
-      .toHaveAttribute('href', '/t/b1a4f8d1-4d16-4872-b391-fda6a0e9012d');
-  });
-
-  test('Should show text for all posts', () => {
-
-    expect(internals.results.getByText('This is the first post'))
-      .toBeVisible();
-    expect(internals.results.getByText('This response came later'))
-      .toBeVisible();
-  });
-
-  test('Should send index and count to posts', () => {
-
-    expect(internals.results.getByTitle('Post 1 of 2 by past_user'))
-      .toBeVisible();
-    expect(internals.results.getByTitle('Post 2 of 2 by future_user'))
-      .toBeVisible();
-  });
-
-  describe('Forum link', () => {
-
-    test('Should show forum if the post has one', () => {
-
-      expect(internals.results.getByText(/^\s*⏃\s*Diversion\s*$/))
-        .toBeVisible();
-    });
-
-    test('Forum text should be a permalink to the forum', () => {
-
-      expect(internals.results.getByText(/^\s*⏃\s*Diversion\s*$/).closest('a'))
-        .toHaveAttribute('href', '/f/diversion');
-    });
-
-    test('Should not show forum if the post doesn\'t have one', () => {
-
-      cleanup();
-      internals.results = render(Topic, { props: {
-        topic: internals.topicWithoutForum
-      } });
-
-      expect(internals.results.queryByText(/^\s*⏃\s*Diversion\s*$/))
-        .toBe(null);
-    });
-  });
-
-  describe('Tag listing', () => {
-
-    test('Should show topic tags', () => {
-
-      expect(internals.results.getByText('fish'))
-        .toBeVisible();
-      expect(internals.results.getByText('fish'))
-        .toHaveTextContent('fish(40)');
-      expect(internals.results.getByText('statue'))
-        .toBeVisible();
-      expect(internals.results.getByText('statue'))
-        .toHaveTextContent('statue(5)');
-    });
-
-    test('Tag text should be a permalink to the tag', () => {
-
-      expect(internals.results.getByText('fish').closest('a'))
-        .toHaveAttribute('href', '/g/fish');
-      expect(internals.results.getByText('statue').closest('a'))
-        .toHaveAttribute('href', '/g/statue');
-    });
-  });
+       beforeAll(() => {
+               addMessages('en', {
+                       'test_forums.diversion': 'Diversion'
+               });
+       });
+
+       beforeEach(() => {
+               internals.results = render(Topic, {
+                       props: {
+                               topic: internals.basicTopic
+                       }
+               });
+       });
+
+       test('Should show the topic title', () => {
+               expect(internals.results.getByText('I sure am a test topic')).toBeVisible();
+       });
+       test('Should display remaining time in readable format', () => {
+               expect(internals.results.getByText(/2 minutes remaining/)).toBeVisible();
+       });
+       test('Remaining time should be a permalink to the topic', () => {
+               expect(internals.results.getByText(/2 minutes remaining/).closest('a')).toHaveAttribute(
+                       'href',
+                       '/t/b1a4f8d1-4d16-4872-b391-fda6a0e9012d'
+               );
+       });
+
+       test('Should show text for all posts', () => {
+               expect(internals.results.getByText('This is the first post')).toBeVisible();
+               expect(internals.results.getByText('This response came later')).toBeVisible();
+       });
+
+       test('Should send index and count to posts', () => {
+               expect(internals.results.getByTitle('Post 1 of 2 by past_user')).toBeVisible();
+               expect(internals.results.getByTitle('Post 2 of 2 by future_user')).toBeVisible();
+       });
+
+       describe('Forum link', () => {
+               test('Should show forum if the post has one', () => {
+                       expect(internals.results.getByText(/^\s*⏃\s*Diversion\s*$/)).toBeVisible();
+               });
+
+               test('Forum text should be a permalink to the forum', () => {
+                       expect(internals.results.getByText(/^\s*⏃\s*Diversion\s*$/).closest('a')).toHaveAttribute(
+                               'href',
+                               '/f/diversion'
+                       );
+               });
+
+               test("Should not show forum if the post doesn't have one", () => {
+                       cleanup();
+                       internals.results = render(Topic, {
+                               props: {
+                                       topic: internals.topicWithoutForum
+                               }
+                       });
+
+                       expect(internals.results.queryByText(/^\s*⏃\s*Diversion\s*$/)).toBe(null);
+               });
+       });
+
+       describe('Tag listing', () => {
+               test('Should show topic tags', () => {
+                       expect(internals.results.getByText('fish')).toBeVisible();
+                       expect(internals.results.getByText('fish')).toHaveTextContent('fish(40)');
+                       expect(internals.results.getByText('statue')).toBeVisible();
+                       expect(internals.results.getByText('statue')).toHaveTextContent('statue(5)');
+               });
+
+               test('Tag text should be a permalink to the tag', () => {
+                       expect(internals.results.getByText('fish').closest('a')).toHaveAttribute('href', '/g/fish');
+                       expect(internals.results.getByText('statue').closest('a')).toHaveAttribute(
+                               'href',
+                               '/g/statue'
+                       );
+               });
+       });
 });
index bfcf8ab21c10974eeb073984f425d0bda958ccfe..39dad0805234eab1161b3b6808c1f652b0c5456d 100644 (file)
@@ -9,14 +9,16 @@
 </script>
 
 <li class="h-entry" title={$_('topic.title')}>
-  <span class="p-name">
-    <a class="u-url u-uid" title={$_('topic.permalink_title')} href="/t/{topic.id}">
-      {topic.title}
-  </a></span>
-    <span class="topic-ttl">({$_('topic.remaining_time', {
+       <span class="p-name">
+               <a class="u-url u-uid" title={$_('topic.permalink_title')} href="/t/{topic.id}">
+                       {topic.title}
+               </a></span
+       >
+       <span class="topic-ttl"
+               >({$_('topic.remaining_time', {
                        values: { remaining: $_(remaining.label, { values: { count: remaining.count } }) }
-      })})
-    </span>
+               })})
+       </span>
 </li>
 
 <style>
index a4c46bf023da220f2187d6faa8a94e567b7d695c..f178c89546b9e0511b880b445d056936f025dba9 100644 (file)
@@ -10,38 +10,35 @@ import '$lib/i18n';
 import TopicSummary from './topic_summary.svelte';
 
 const internals = {
-  results: null
+       results: null
 };
 
 describe('Topic Summary component', () => {
-
-  beforeEach(() => {
-
-    internals.results = render(TopicSummary, { props: {
-      topic: {
-        id: 'ea2431c8-5c1c-4ed0-907a-45e012696ab8',
-        title: 'I sure am a test topic',
-        ttl: 160 * 1000,
-        updated_at: Date.now()
-      }
-    } });
-  });
-
-  test('It should display the title', () => {
-
-    expect(internals.results.getByText('I sure am a test topic'))
-      .toBeVisible();
-  });
-
-  test('Topic title should be a permalink', () => {
-
-    expect(internals.results.getByText('I sure am a test topic').closest('a'))
-      .toHaveAttribute('href', '/t/ea2431c8-5c1c-4ed0-907a-45e012696ab8');
-  });
-
-  test('It should display remaining time in readable format', () => {
-
-    expect(internals.results.getByText(/2 minutes remaining/))
-      .toBeVisible();
-  });
+       beforeEach(() => {
+               internals.results = render(TopicSummary, {
+                       props: {
+                               topic: {
+                                       id: 'ea2431c8-5c1c-4ed0-907a-45e012696ab8',
+                                       title: 'I sure am a test topic',
+                                       ttl: 160 * 1000,
+                                       updated_at: Date.now()
+                               }
+                       }
+               });
+       });
+
+       test('It should display the title', () => {
+               expect(internals.results.getByText('I sure am a test topic')).toBeVisible();
+       });
+
+       test('Topic title should be a permalink', () => {
+               expect(internals.results.getByText('I sure am a test topic').closest('a')).toHaveAttribute(
+                       'href',
+                       '/t/ea2431c8-5c1c-4ed0-907a-45e012696ab8'
+               );
+       });
+
+       test('It should display remaining time in readable format', () => {
+               expect(internals.results.getByText(/2 minutes remaining/)).toBeVisible();
+       });
 });
index 448e1db90f933fbc04280ac958f3951ac558ac59..7752dd71724136317c19f9e0d6728ea1b845850f 100644 (file)
@@ -1,15 +1,15 @@
 export const apollo = {
-  uri: 'http://127.0.0.1:1234/graphql',
-  name: 'COOL_APP',
-  version: '9.9.9',
-  defaultOptions: {
-    watchQuery: {
-      fetchPolicy: 'no-cache'
-    },
-    query: {
-      fetchPolicy: 'no-cache'
-    }
-  }
+       uri: 'http://127.0.0.1:1234/graphql',
+       name: 'COOL_APP',
+       version: '9.9.9',
+       defaultOptions: {
+               watchQuery: {
+                       fetchPolicy: 'no-cache'
+               },
+               query: {
+                       fetchPolicy: 'no-cache'
+               }
+       }
 };
 
 export const version = '9.9.9';
index a3820ed70355cc24a896c55e759874601c019865..826fd288b2eb382630697797febd55ff242a8f8b 100644 (file)
@@ -5,10 +5,10 @@ import { apollo as apolloConfig } from './config';
 const cache = new InMemoryCache();
 
 export const client = new ApolloClient({
-  cache,
-  link: new HttpLink({
-    uri: apolloConfig.uri,
-    fetch
-  }),
-  ...apolloConfig
+       cache,
+       link: new HttpLink({
+               uri: apolloConfig.uri,
+               fetch
+       }),
+       ...apolloConfig
 });
index 1ec5ab2c8070f83938ddaee4213cfd4a4ae34be5..efb7deadb7278dbe8b28aa783467d4f5a3e9a178 100644 (file)
@@ -1,5 +1,5 @@
 const internals = {
-  version: '1.0.0'
+       version: '1.0.0'
 };
 
 /*
@@ -9,9 +9,9 @@ const internals = {
  */
 
 export const apollo = {
-  uri: import.meta.env.VITE_APOLLO_SERVER,
-  name: 'forum',
-  version: internals.version
+       uri: import.meta.env.VITE_APOLLO_SERVER,
+       name: 'forum',
+       version: internals.version
 };
 
 export const version = internals.version;
index 5dd533a911999bff9b4454c1009992c576106d56..2f6edb889c3763ea7318f73d7e25361e570eb8ff 100644 (file)
@@ -7,6 +7,6 @@ addMessages('en', en);
 addMessages('es', es);
 
 init({
-  fallbackLocale: 'en',
-  initialLocale: getLocaleFromNavigator().replace(/-[A-Z]{2}$/, '')
+       fallbackLocale: 'en',
+       initialLocale: getLocaleFromNavigator().replace(/-[A-Z]{2}$/, '')
 });
index c6505369b259631a8610dc249397f3ed1b9336f1..39e1f6eb22125bc7d1a23ebd5c403c484a32ff1e 100644 (file)
@@ -1,32 +1,25 @@
 import { enableTopicActions, disableTopicActions, topicActions } from './actions';
 
 describe('Topic actions and state', () => {
-
-  test('There should be no topic actions by default', () => {
-
-    topicActions.subscribe((actions) => {
-
-      expect(actions).toBe(undefined);
-    })();
-  });
-
-  test('enableTopicActions should set the topic id', () => {
-
-    enableTopicActions('free_hat');
-    topicActions.subscribe((actions) => {
-
-      expect(actions).toEqual({
-        id: 'free_hat'
-      });
-    })();
-  });
-
-  test('disableTopicActions should unset the topic id', () => {
-
-    disableTopicActions();
-    topicActions.subscribe((actions) => {
-
-      expect(actions).toEqual(undefined);
-    })();
-  });
+       test('There should be no topic actions by default', () => {
+               topicActions.subscribe((actions) => {
+                       expect(actions).toBe(undefined);
+               })();
+       });
+
+       test('enableTopicActions should set the topic id', () => {
+               enableTopicActions('free_hat');
+               topicActions.subscribe((actions) => {
+                       expect(actions).toEqual({
+                               id: 'free_hat'
+                       });
+               })();
+       });
+
+       test('disableTopicActions should unset the topic id', () => {
+               disableTopicActions();
+               topicActions.subscribe((actions) => {
+                       expect(actions).toEqual(undefined);
+               })();
+       });
 });
index 95702dc10b7404a913b489254ed8eb4fe71bb050..19e9a6976b4465764d2cb3934f073378ef545a99 100644 (file)
@@ -2,11 +2,11 @@ import { derived, writable } from 'svelte/store';
 import type { Readable, Writable } from 'svelte/store';
 
 export type Actions = {
-  topic?: TopicAction
+       topic?: TopicAction;
 };
 
 export type TopicAction = {
-  id: string
+       id: string;
 };
 
 /*
@@ -16,26 +16,19 @@ export type TopicAction = {
 const actions: Writable<Actions> = writable({});
 
 export const enableTopicActions = (id: string) => {
-
-  actions.update((actionsValue: Actions): Actions => {
-
-    actionsValue.topic = {
-      id
-    };
-    return actionsValue;
-  });
+       actions.update((actionsValue: Actions): Actions => {
+               actionsValue.topic = {
+                       id
+               };
+               return actionsValue;
+       });
 };
 
 export const disableTopicActions = () => {
-
-  actions.update((actionsValue): Actions => {
-
-    delete actionsValue.topic;
-    return actionsValue;
-  });
+       actions.update((actionsValue): Actions => {
+               delete actionsValue.topic;
+               return actionsValue;
+       });
 };
 
-export const topicActions: Readable<TopicAction> = derived(
-  actions,
-  ($actions) => $actions.topic
-);
+export const topicActions: Readable<TopicAction> = derived(actions, ($actions) => $actions.topic);
index 12463c334fca5e21d35bc8f885bd6dceb674b260..4ef1986bec301e15b9bba6778734ad84b2bc61b9 100644 (file)
@@ -10,55 +10,53 @@ import type { Readable } from 'svelte/store';
  */
 
 type ApolloStoreConfiguration<Type> = {
-  key: string,
-  query: DocumentNode,
-  initialValue?: Type | void
-  variables?: object
+       key: string;
+       query: DocumentNode;
+       initialValue?: Type | void;
+       variables?: object;
 };
 
 type ApolloStoreState<Type> = {
-  loading: boolean,
-  data: Type | void,
-  error: Error | void
+       loading: boolean;
+       data: Type | void;
+       error: Error | void;
 };
 
-export const store = function store<Type>({ key, query, initialValue = null, variables = {} }: ApolloStoreConfiguration<Type>): Readable<ApolloStoreState<Type>> {
-
-  const initialState: ApolloStoreState<Type> = {
-      loading: true,
-      data: initialValue,
-      error: undefined
-  };
-
-  return readable(
-    initialState,
-    (set) => {
-
-      const handleError = function (error: Error) {
-
-        return set({
-          loading: false,
-          data: initialValue,
-          error
-        });
-      };
-
-      client.watchQuery({ query, variables }).subscribe(
-        (result: ApolloQueryResult<Type>) => {
-
-          if (result.errors) {
-            const error = new ApolloError({ graphQLErrors: result.errors });
-            return handleError(error);
-          }
-
-          set({
-            loading: false,
-            data: result.data[key],
-            error: undefined
-          });
-        },
-        (error: Error) => handleError(error)
-      );
-    }
-  );
+export const store = function store<Type>({
+       key,
+       query,
+       initialValue = null,
+       variables = {}
+}: ApolloStoreConfiguration<Type>): Readable<ApolloStoreState<Type>> {
+       const initialState: ApolloStoreState<Type> = {
+               loading: true,
+               data: initialValue,
+               error: undefined
+       };
+
+       return readable(initialState, (set) => {
+               const handleError = function (error: Error) {
+                       return set({
+                               loading: false,
+                               data: initialValue,
+                               error
+                       });
+               };
+
+               client.watchQuery({ query, variables }).subscribe(
+                       (result: ApolloQueryResult<Type>) => {
+                               if (result.errors) {
+                                       const error = new ApolloError({ graphQLErrors: result.errors });
+                                       return handleError(error);
+                               }
+
+                               set({
+                                       loading: false,
+                                       data: result.data[key],
+                                       error: undefined
+                               });
+                       },
+                       (error: Error) => handleError(error)
+               );
+       });
 };
index 5a8c723bcacf590937ca7265387e610d8a37343a..1a332908f02b20b056fdf4e07aa5cf6bcf9b7f64 100644 (file)
@@ -10,43 +10,38 @@ jest.mock('$lib/config/config.ts');
 import { getForum, getForums } from './forums';
 
 const internals = {
-  provider: null
+       provider: null
 };
 
 describe('Forums store pact', () => {
-
-  beforeAll(async () => {
-
-    internals.provider = new Pact({
-      port: 1234,
-      dir: resolve(process.cwd(), 'pacts'),
-      consumer: 'ForumClient',
-      provider: 'ForumServer',
-      pactfileWriteMode: 'update'
-    });
-
-    await internals.provider.setup();
-  });
-
-  afterEach(() => internals.provider.verify());
-  afterAll(() => internals.provider.finalize());
-
-  describe('When there\'s data', () => {
-
-    describe('GetForums', () => {
-
-      beforeAll(async () => {
-
-        const forumQuery = new GraphQLInteraction()
-          .given('there\'s data')
-          .uponReceiving('a request to list the forums')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetForums')
-          .withQuery(
-            `query GetForums {
+       beforeAll(async () => {
+               internals.provider = new Pact({
+                       port: 1234,
+                       dir: resolve(process.cwd(), 'pacts'),
+                       consumer: 'ForumClient',
+                       provider: 'ForumServer',
+                       pactfileWriteMode: 'update'
+               });
+
+               await internals.provider.setup();
+       });
+
+       afterEach(() => internals.provider.verify());
+       afterAll(() => internals.provider.finalize());
+
+       describe("When there's data", () => {
+               describe('GetForums', () => {
+                       beforeAll(async () => {
+                               const forumQuery = new GraphQLInteraction()
+                                       .given("there's data")
+                                       .uponReceiving('a request to list the forums')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetForums')
+                                       .withQuery(
+                                               `query GetForums {
               forums {
                 id
                 glyph
@@ -55,67 +50,67 @@ describe('Forums store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({})
-          .willRespondWith({
-            status: 200,
-            headers: {
-              'Content-Type': 'application/json; charset=utf-8'
-            },
-            body: {
-              data: {
-                forums: eachLike({
-                  id: like('butter'),
-                  glyph: like('⌘'),
-                  label: like('test_forums.butter'),
-                  position: like(1)
-                })
-              }
-            }
-          });
-        return await internals.provider.addInteraction(forumQuery);
-      });
-
-      test('it returns the forums', async () => {
-
-        const forums = getForums();
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        forums.subscribe((forumsValue) => {
-
-          response = forumsValue;
-          counter();
-        });
-        expect(response.data).toBeInstanceOf(Array);
-        expect(response.data.length).toBe(0);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data).toEqual(expect.arrayContaining([{
-          id: 'butter',
-          glyph: '⌘',
-          label: 'test_forums.butter',
-          position: 1
-        }]));
-        expect(response.loading).toBe(false);
-        expect(response.error).toBe(undefined);
-      });
-    });
-
-    describe('GetForum', () => {
-
-      beforeAll(async () => {
-
-        const forumQuery = new GraphQLInteraction()
-          .given('there\'s data')
-          .uponReceiving('a request to get a single forum')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetForum')
-          .withQuery(
-            `query GetForum($id: ID!) {
+                                       )
+                                       .withVariables({})
+                                       .willRespondWith({
+                                               status: 200,
+                                               headers: {
+                                                       'Content-Type': 'application/json; charset=utf-8'
+                                               },
+                                               body: {
+                                                       data: {
+                                                               forums: eachLike({
+                                                                       id: like('butter'),
+                                                                       glyph: like('⌘'),
+                                                                       label: like('test_forums.butter'),
+                                                                       position: like(1)
+                                                               })
+                                                       }
+                                               }
+                                       });
+                               return await internals.provider.addInteraction(forumQuery);
+                       });
+
+                       test('it returns the forums', async () => {
+                               const forums = getForums();
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               forums.subscribe((forumsValue) => {
+                                       response = forumsValue;
+                                       counter();
+                               });
+                               expect(response.data).toBeInstanceOf(Array);
+                               expect(response.data.length).toBe(0);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data).toEqual(
+                                       expect.arrayContaining([
+                                               {
+                                                       id: 'butter',
+                                                       glyph: '⌘',
+                                                       label: 'test_forums.butter',
+                                                       position: 1
+                                               }
+                                       ])
+                               );
+                               expect(response.loading).toBe(false);
+                               expect(response.error).toBe(undefined);
+                       });
+               });
+
+               describe('GetForum', () => {
+                       beforeAll(async () => {
+                               const forumQuery = new GraphQLInteraction()
+                                       .given("there's data")
+                                       .uponReceiving('a request to get a single forum')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetForum')
+                                       .withQuery(
+                                               `query GetForum($id: ID!) {
               forum(id: $id) {
                 id
                 glyph
@@ -131,81 +126,80 @@ describe('Forums store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({
-            id: 'freezer'
-          })
-          .willRespondWith({
-            status: 200,
-            headers: {
-              'Content-Type': 'application/json; charset=utf-8'
-            },
-            body: {
-              data: {
-                forum: like({
-                  id: 'freezer',
-                  glyph: like('✭'),
-                  label: like('test_forums.freezer'),
-                  position: like(3),
-                  topics: eachLike({
-                    id: like('629de02c-151a-4db7-bb86-43b2add8a15a'),
-                    title: like('Very pacty topic'),
-                    updated_at: like(1619954611616),
-                    ttl: like(3601)
-                  })
-                })
-              }
-            }
-          });
-        return await internals.provider.addInteraction(forumQuery);
-      });
-
-      test('it returns the forum', async () => {
-
-        const forum = getForum('freezer');
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        forum.subscribe((forumsValue) => {
-
-          response = forumsValue;
-          counter();
-        });
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data.id).toBe('freezer');
-        expect(response.data.glyph).toBe('✭');
-        expect(response.data.label).toBe('test_forums.freezer');
-        expect(response.data.position).toBe(3);
-        expect(response.data.topics).toEqual(expect.arrayContaining([{
-          id: '629de02c-151a-4db7-bb86-43b2add8a15a',
-          title: 'Very pacty topic',
-          updated_at: 1619954611616,
-          ttl: 3601
-        }]));
-        expect(response.loading).toBe(false);
-        expect(response.error).toBe(undefined);
-      });
-    });
-  });
-
-  describe('When there\'s no data', () => {
-
-    describe('GetForums', () => {
-
-      beforeAll(async () => {
-
-        const forumQuery = new GraphQLInteraction()
-          .given('there\'s no data')
-          .uponReceiving('a request to list the forums')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetForums')
-          .withQuery(
-            `query GetForums {
+                                       )
+                                       .withVariables({
+                                               id: 'freezer'
+                                       })
+                                       .willRespondWith({
+                                               status: 200,
+                                               headers: {
+                                                       'Content-Type': 'application/json; charset=utf-8'
+                                               },
+                                               body: {
+                                                       data: {
+                                                               forum: like({
+                                                                       id: 'freezer',
+                                                                       glyph: like('✭'),
+                                                                       label: like('test_forums.freezer'),
+                                                                       position: like(3),
+                                                                       topics: eachLike({
+                                                                               id: like('629de02c-151a-4db7-bb86-43b2add8a15a'),
+                                                                               title: like('Very pacty topic'),
+                                                                               updated_at: like(1619954611616),
+                                                                               ttl: like(3601)
+                                                                       })
+                                                               })
+                                                       }
+                                               }
+                                       });
+                               return await internals.provider.addInteraction(forumQuery);
+                       });
+
+                       test('it returns the forum', async () => {
+                               const forum = getForum('freezer');
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               forum.subscribe((forumsValue) => {
+                                       response = forumsValue;
+                                       counter();
+                               });
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data.id).toBe('freezer');
+                               expect(response.data.glyph).toBe('✭');
+                               expect(response.data.label).toBe('test_forums.freezer');
+                               expect(response.data.position).toBe(3);
+                               expect(response.data.topics).toEqual(
+                                       expect.arrayContaining([
+                                               {
+                                                       id: '629de02c-151a-4db7-bb86-43b2add8a15a',
+                                                       title: 'Very pacty topic',
+                                                       updated_at: 1619954611616,
+                                                       ttl: 3601
+                                               }
+                                       ])
+                               );
+                               expect(response.loading).toBe(false);
+                               expect(response.error).toBe(undefined);
+                       });
+               });
+       });
+
+       describe("When there's no data", () => {
+               describe('GetForums', () => {
+                       beforeAll(async () => {
+                               const forumQuery = new GraphQLInteraction()
+                                       .given("there's no data")
+                                       .uponReceiving('a request to list the forums')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetForums')
+                                       .withQuery(
+                                               `query GetForums {
               forums {
                 id
                 glyph
@@ -214,58 +208,54 @@ describe('Forums store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({})
-          .willRespondWith({
-            status: 200,
-            headers: {
-              'Content-Type': 'application/json; charset=utf-8'
-            },
-            body: {
-              data: {
-                forums: []
-              }
-            }
-          });
-        return await internals.provider.addInteraction(forumQuery);
-      });
-
-      test('it returns the forums', async () => {
-
-        const forums = getForums();
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        forums.subscribe((forumsValue) => {
-
-          response = forumsValue;
-          counter();
-        });
-        expect(response.data).toBeInstanceOf(Array);
-        expect(response.data.length).toBe(0);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data).toBeInstanceOf(Array);
-        expect(response.data.length).toBe(0);
-        expect(response.loading).toBe(false);
-        expect(response.error).toBe(undefined);
-      });
-    });
-
-    describe('GetForum', () => {
-
-      beforeAll(async () => {
-
-        const forumQuery = new GraphQLInteraction()
-          .given('there\'s no data')
-          .uponReceiving('a request to get a single forum')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetForum')
-          .withQuery(
-            `query GetForum($id: ID!) {
+                                       )
+                                       .withVariables({})
+                                       .willRespondWith({
+                                               status: 200,
+                                               headers: {
+                                                       'Content-Type': 'application/json; charset=utf-8'
+                                               },
+                                               body: {
+                                                       data: {
+                                                               forums: []
+                                                       }
+                                               }
+                                       });
+                               return await internals.provider.addInteraction(forumQuery);
+                       });
+
+                       test('it returns the forums', async () => {
+                               const forums = getForums();
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               forums.subscribe((forumsValue) => {
+                                       response = forumsValue;
+                                       counter();
+                               });
+                               expect(response.data).toBeInstanceOf(Array);
+                               expect(response.data.length).toBe(0);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data).toBeInstanceOf(Array);
+                               expect(response.data.length).toBe(0);
+                               expect(response.loading).toBe(false);
+                               expect(response.error).toBe(undefined);
+                       });
+               });
+
+               describe('GetForum', () => {
+                       beforeAll(async () => {
+                               const forumQuery = new GraphQLInteraction()
+                                       .given("there's no data")
+                                       .uponReceiving('a request to get a single forum')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetForum')
+                                       .withQuery(
+                                               `query GetForum($id: ID!) {
               forum(id: $id) {
                 id
                 glyph
@@ -281,61 +271,56 @@ describe('Forums store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({
-            id: 'freezer'
-          })
-          .willRespondWith({
-            status: 200,
-            headers: {
-              'Content-Type': 'application/json; charset=utf-8'
-            },
-            body: {
-              data: {
-                forum: null
-              }
-            }
-          });
-        return await internals.provider.addInteraction(forumQuery);
-      });
-
-      test('it returns the forum', async () => {
-
-        const forum = getForum('freezer');
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        forum.subscribe((forumsValue) => {
-
-          response = forumsValue;
-          counter();
-        });
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(false);
-        expect(response.error).toBe(undefined);
-      });
-    });
-  });
-
-  describe('When there\'s a server error', () => {
-
-    describe('GetForums', () => {
-
-      beforeAll(async () => {
-
-        const forumQuery = new GraphQLInteraction()
-          .given('there\'s a server error')
-          .uponReceiving('a request to list the forums')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetForums')
-          .withQuery(
-            `query GetForums {
+                                       )
+                                       .withVariables({
+                                               id: 'freezer'
+                                       })
+                                       .willRespondWith({
+                                               status: 200,
+                                               headers: {
+                                                       'Content-Type': 'application/json; charset=utf-8'
+                                               },
+                                               body: {
+                                                       data: {
+                                                               forum: null
+                                                       }
+                                               }
+                                       });
+                               return await internals.provider.addInteraction(forumQuery);
+                       });
+
+                       test('it returns the forum', async () => {
+                               const forum = getForum('freezer');
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               forum.subscribe((forumsValue) => {
+                                       response = forumsValue;
+                                       counter();
+                               });
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(false);
+                               expect(response.error).toBe(undefined);
+                       });
+               });
+       });
+
+       describe("When there's a server error", () => {
+               describe('GetForums', () => {
+                       beforeAll(async () => {
+                               const forumQuery = new GraphQLInteraction()
+                                       .given("there's a server error")
+                                       .uponReceiving('a request to list the forums')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetForums')
+                                       .withQuery(
+                                               `query GetForums {
               forums {
                 id
                 glyph
@@ -344,50 +329,46 @@ describe('Forums store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({})
-          .willRespondWith({
-            status: 500
-          });
-        return await internals.provider.addInteraction(forumQuery);
-      });
-
-      test('it returns the error', async () => {
-
-        const forums = getForums();
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        forums.subscribe((forumsValue) => {
-
-          response = forumsValue;
-          counter();
-        });
-        expect(response.data).toBeInstanceOf(Array);
-        expect(response.data.length).toBe(0);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data).toBeInstanceOf(Array);
-        expect(response.data.length).toBe(0);
-        expect(response.loading).toBe(false);
-        expect(response.error).toBeInstanceOf(Error);
-      });
-    });
-
-    describe('GetForum', () => {
-
-      beforeAll(async () => {
-
-        const forumQuery = new GraphQLInteraction()
-          .given('there\'s a server error')
-          .uponReceiving('a request to get a single forum')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetForum')
-          .withQuery(
-            `query GetForum($id: ID!) {
+                                       )
+                                       .withVariables({})
+                                       .willRespondWith({
+                                               status: 500
+                                       });
+                               return await internals.provider.addInteraction(forumQuery);
+                       });
+
+                       test('it returns the error', async () => {
+                               const forums = getForums();
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               forums.subscribe((forumsValue) => {
+                                       response = forumsValue;
+                                       counter();
+                               });
+                               expect(response.data).toBeInstanceOf(Array);
+                               expect(response.data.length).toBe(0);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data).toBeInstanceOf(Array);
+                               expect(response.data.length).toBe(0);
+                               expect(response.loading).toBe(false);
+                               expect(response.error).toBeInstanceOf(Error);
+                       });
+               });
+
+               describe('GetForum', () => {
+                       beforeAll(async () => {
+                               const forumQuery = new GraphQLInteraction()
+                                       .given("there's a server error")
+                                       .uponReceiving('a request to get a single forum')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetForum')
+                                       .withQuery(
+                                               `query GetForum($id: ID!) {
               forum(id: $id) {
                 id
                 glyph
@@ -403,53 +384,48 @@ describe('Forums store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({
-            id: 'freezer'
-          })
-          .willRespondWith({
-            status: 500
-          });
-        return await internals.provider.addInteraction(forumQuery);
-      });
-
-      test('it returns the error', async () => {
-
-        const forum = getForum('freezer');
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        forum.subscribe((forumsValue) => {
-
-          response = forumsValue;
-          counter();
-        });
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(false);
-        expect(response.error).toBeInstanceOf(Error);
-      });
-    });
-  });
-
-  describe('When there\'s an error in the response', () => {
-
-    describe('GetForums', () => {
-
-      beforeAll(async () => {
-
-        const forumQuery = new GraphQLInteraction()
-          .given('there\'s an error in the response')
-          .uponReceiving('a request to list the forums')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetForums')
-          .withQuery(
-            `query GetForums {
+                                       )
+                                       .withVariables({
+                                               id: 'freezer'
+                                       })
+                                       .willRespondWith({
+                                               status: 500
+                                       });
+                               return await internals.provider.addInteraction(forumQuery);
+                       });
+
+                       test('it returns the error', async () => {
+                               const forum = getForum('freezer');
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               forum.subscribe((forumsValue) => {
+                                       response = forumsValue;
+                                       counter();
+                               });
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(false);
+                               expect(response.error).toBeInstanceOf(Error);
+                       });
+               });
+       });
+
+       describe("When there's an error in the response", () => {
+               describe('GetForums', () => {
+                       beforeAll(async () => {
+                               const forumQuery = new GraphQLInteraction()
+                                       .given("there's an error in the response")
+                                       .uponReceiving('a request to list the forums')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetForums')
+                                       .withQuery(
+                                               `query GetForums {
               forums {
                 id
                 glyph
@@ -458,60 +434,60 @@ describe('Forums store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({})
-          .willRespondWith({
-            status: 200,
-            headers: {
-              'Content-Type': 'application/json; charset=utf-8'
-            },
-            body: {
-              errors: eachLike({
-                message: like('An error occurred when fetching forums')
-              })
-            }
-          });
-        return await internals.provider.addInteraction(forumQuery);
-      });
-
-      test('it returns the error', async () => {
-
-        const forums = getForums();
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        forums.subscribe((forumsValue) => {
-
-          response = forumsValue;
-          counter();
-        });
-        expect(response.data).toBeInstanceOf(Array);
-        expect(response.data.length).toBe(0);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data).toBeInstanceOf(Array);
-        expect(response.data.length).toBe(0);
-        expect(response.loading).toBe(false);
-        expect(response.error.graphQLErrors).toEqual(expect.arrayContaining([{
-          message: 'An error occurred when fetching forums'
-        }]));
-      });
-    });
-
-    describe('GetForum', () => {
-
-      beforeAll(async () => {
-
-        const forumQuery = new GraphQLInteraction()
-          .given('there\'s an error in the response')
-          .uponReceiving('a request to get a single forum')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetForum')
-          .withQuery(
-            `query GetForum($id: ID!) {
+                                       )
+                                       .withVariables({})
+                                       .willRespondWith({
+                                               status: 200,
+                                               headers: {
+                                                       'Content-Type': 'application/json; charset=utf-8'
+                                               },
+                                               body: {
+                                                       errors: eachLike({
+                                                               message: like('An error occurred when fetching forums')
+                                                       })
+                                               }
+                                       });
+                               return await internals.provider.addInteraction(forumQuery);
+                       });
+
+                       test('it returns the error', async () => {
+                               const forums = getForums();
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               forums.subscribe((forumsValue) => {
+                                       response = forumsValue;
+                                       counter();
+                               });
+                               expect(response.data).toBeInstanceOf(Array);
+                               expect(response.data.length).toBe(0);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data).toBeInstanceOf(Array);
+                               expect(response.data.length).toBe(0);
+                               expect(response.loading).toBe(false);
+                               expect(response.error.graphQLErrors).toEqual(
+                                       expect.arrayContaining([
+                                               {
+                                                       message: 'An error occurred when fetching forums'
+                                               }
+                                       ])
+                               );
+                       });
+               });
+
+               describe('GetForum', () => {
+                       beforeAll(async () => {
+                               const forumQuery = new GraphQLInteraction()
+                                       .given("there's an error in the response")
+                                       .uponReceiving('a request to get a single forum')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetForum')
+                                       .withQuery(
+                                               `query GetForum($id: ID!) {
               forum(id: $id) {
                 id
                 glyph
@@ -527,44 +503,46 @@ describe('Forums store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({
-            id: 'freezer'
-          })
-          .willRespondWith({
-            status: 200,
-            headers: {
-              'Content-Type': 'application/json; charset=utf-8'
-            },
-            body: {
-              errors: eachLike({
-                message: like('An error occurred when fetching the forum')
-              })
-            }
-          });
-        return await internals.provider.addInteraction(forumQuery);
-      });
-
-      test('it returns the error', async () => {
-
-        const forum = getForum('freezer');
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        forum.subscribe((forumsValue) => {
-
-          response = forumsValue;
-          counter();
-        });
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(false);
-        expect(response.error.graphQLErrors).toEqual(expect.arrayContaining([{
-          message: 'An error occurred when fetching the forum'
-        }]));
-      });
-    });
-  });
+                                       )
+                                       .withVariables({
+                                               id: 'freezer'
+                                       })
+                                       .willRespondWith({
+                                               status: 200,
+                                               headers: {
+                                                       'Content-Type': 'application/json; charset=utf-8'
+                                               },
+                                               body: {
+                                                       errors: eachLike({
+                                                               message: like('An error occurred when fetching the forum')
+                                                       })
+                                               }
+                                       });
+                               return await internals.provider.addInteraction(forumQuery);
+                       });
+
+                       test('it returns the error', async () => {
+                               const forum = getForum('freezer');
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               forum.subscribe((forumsValue) => {
+                                       response = forumsValue;
+                                       counter();
+                               });
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(false);
+                               expect(response.error.graphQLErrors).toEqual(
+                                       expect.arrayContaining([
+                                               {
+                                                       message: 'An error occurred when fetching the forum'
+                                               }
+                                       ])
+                               );
+                       });
+               });
+       });
 });
index cb62b5a037f2cf5db6e9175497de3f07156bda14..ab0206610a5e4d3b5ca2d887c207624d07ee8449 100644 (file)
@@ -1,5 +1,6 @@
 import { store } from './apollo';
 import { GET_FORUM, GET_FORUMS } from '$lib/data/queries';
 
-export const getForum = (id: string) => store({ key: 'forum', query: GET_FORUM, variables: { id } });
+export const getForum = (id: string) =>
+       store({ key: 'forum', query: GET_FORUM, variables: { id } });
 export const getForums = () => store({ key: 'forums', query: GET_FORUMS, initialValue: [] });
index afc22f387f9c55d3a41b12d51ec25d70f3530b08..ef1835d8f1c14052e295f4855e20e84ac294fdf7 100644 (file)
@@ -10,43 +10,38 @@ jest.mock('$lib/config/config.ts');
 import { getPost } from './posts';
 
 const internals = {
-  provider: null
+       provider: null
 };
 
 describe('Posts store pact', () => {
-
-  beforeAll(async () => {
-
-    internals.provider = new Pact({
-      port: 1234,
-      dir: resolve(process.cwd(), 'pacts'),
-      consumer: 'ForumClient',
-      provider: 'ForumServer',
-      pactfileWriteMode: 'update'
-    });
-
-    await internals.provider.setup();
-  });
-
-  afterEach(() => internals.provider.verify());
-  afterAll(() => internals.provider.finalize());
-
-  describe('When there\'s data', () => {
-
-    describe('GetPost', () => {
-
-      beforeAll(async () => {
-
-        const postQuery = new GraphQLInteraction()
-          .given('there\'s data')
-          .uponReceiving('a request to get a single post')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetPost')
-          .withQuery(
-            `query GetPost($id: ID!) {
+       beforeAll(async () => {
+               internals.provider = new Pact({
+                       port: 1234,
+                       dir: resolve(process.cwd(), 'pacts'),
+                       consumer: 'ForumClient',
+                       provider: 'ForumServer',
+                       pactfileWriteMode: 'update'
+               });
+
+               await internals.provider.setup();
+       });
+
+       afterEach(() => internals.provider.verify());
+       afterAll(() => internals.provider.finalize());
+
+       describe("When there's data", () => {
+               describe('GetPost', () => {
+                       beforeAll(async () => {
+                               const postQuery = new GraphQLInteraction()
+                                       .given("there's data")
+                                       .uponReceiving('a request to get a single post')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetPost')
+                                       .withQuery(
+                                               `query GetPost($id: ID!) {
               post(id: $id) {
                 id
                 text
@@ -64,85 +59,80 @@ describe('Posts store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({
-            id: '8f75eba5-6989-4dd3-b466-e464546ce374'
-          })
-          .willRespondWith({
-            status: 200,
-            headers: {
-              'Content-Type': 'application/json; charset=utf-8'
-            },
-            body: {
-              data: {
-                post: like({
-                  id: like('8f75eba5-6989-4dd3-b466-e464546ce374'),
-                  text: like('This is a very pacty post'),
-                  created_at: like(1619976194937),
-                  author: like({
-                    id: like('a805b3de-cac4-451c-a1e6-f078869c9db9'),
-                    handle: like('pacts_person')
-                  }),
-                  topic: like({
-                    id: like('5c283ce1-0470-4b98-86f5-1fec9a22c9ac'),
-                    title: like('The parent pacts topic')
-                  })
-                })
-              }
-            }
-          });
-        return await internals.provider.addInteraction(postQuery);
-      });
-
-      test('it returns the post', async () => {
-
-        const post = getPost('8f75eba5-6989-4dd3-b466-e464546ce374');
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        post.subscribe((postValue) => {
-
-          response = postValue;
-          counter();
-        });
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data).toEqual({
-          id: '8f75eba5-6989-4dd3-b466-e464546ce374',
-          text: 'This is a very pacty post',
-          created_at: 1619976194937,
-          author: {
-            id: 'a805b3de-cac4-451c-a1e6-f078869c9db9',
-            handle: 'pacts_person'
-          },
-          topic: {
-            id: '5c283ce1-0470-4b98-86f5-1fec9a22c9ac',
-            title: 'The parent pacts topic'
-          }
-        });
-        expect(response.loading).toBe(false);
-        expect(response.error).toBe(undefined);
-      });
-    });
-  });
-
-  describe('When there\'s no data', () => {
-
-    describe('GetPost', () => {
-
-      beforeAll(async () => {
-
-        const postQuery = new GraphQLInteraction()
-          .given('there\'s no data')
-          .uponReceiving('a request to get a single post')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetPost')
-          .withQuery(
-            `query GetPost($id: ID!) {
+                                       )
+                                       .withVariables({
+                                               id: '8f75eba5-6989-4dd3-b466-e464546ce374'
+                                       })
+                                       .willRespondWith({
+                                               status: 200,
+                                               headers: {
+                                                       'Content-Type': 'application/json; charset=utf-8'
+                                               },
+                                               body: {
+                                                       data: {
+                                                               post: like({
+                                                                       id: like('8f75eba5-6989-4dd3-b466-e464546ce374'),
+                                                                       text: like('This is a very pacty post'),
+                                                                       created_at: like(1619976194937),
+                                                                       author: like({
+                                                                               id: like('a805b3de-cac4-451c-a1e6-f078869c9db9'),
+                                                                               handle: like('pacts_person')
+                                                                       }),
+                                                                       topic: like({
+                                                                               id: like('5c283ce1-0470-4b98-86f5-1fec9a22c9ac'),
+                                                                               title: like('The parent pacts topic')
+                                                                       })
+                                                               })
+                                                       }
+                                               }
+                                       });
+                               return await internals.provider.addInteraction(postQuery);
+                       });
+
+                       test('it returns the post', async () => {
+                               const post = getPost('8f75eba5-6989-4dd3-b466-e464546ce374');
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               post.subscribe((postValue) => {
+                                       response = postValue;
+                                       counter();
+                               });
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data).toEqual({
+                                       id: '8f75eba5-6989-4dd3-b466-e464546ce374',
+                                       text: 'This is a very pacty post',
+                                       created_at: 1619976194937,
+                                       author: {
+                                               id: 'a805b3de-cac4-451c-a1e6-f078869c9db9',
+                                               handle: 'pacts_person'
+                                       },
+                                       topic: {
+                                               id: '5c283ce1-0470-4b98-86f5-1fec9a22c9ac',
+                                               title: 'The parent pacts topic'
+                                       }
+                               });
+                               expect(response.loading).toBe(false);
+                               expect(response.error).toBe(undefined);
+                       });
+               });
+       });
+
+       describe("When there's no data", () => {
+               describe('GetPost', () => {
+                       beforeAll(async () => {
+                               const postQuery = new GraphQLInteraction()
+                                       .given("there's no data")
+                                       .uponReceiving('a request to get a single post')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetPost')
+                                       .withQuery(
+                                               `query GetPost($id: ID!) {
               post(id: $id) {
                 id
                 text
@@ -160,61 +150,56 @@ describe('Posts store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({
-            id: '8f75eba5-6989-4dd3-b466-e464546ce374'
-          })
-          .willRespondWith({
-            status: 200,
-            headers: {
-              'Content-Type': 'application/json; charset=utf-8'
-            },
-            body: {
-              data: {
-                post: null
-              }
-            }
-          });
-        return await internals.provider.addInteraction(postQuery);
-      });
-
-      test('it returns the post', async () => {
-
-        const post = getPost('8f75eba5-6989-4dd3-b466-e464546ce374');
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        post.subscribe((postValue) => {
-
-          response = postValue;
-          counter();
-        });
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(false);
-        expect(response.error).toBe(undefined);
-      });
-    });
-  });
-
-  describe('When there\'s a server error', () => {
-
-    describe('GetPost', () => {
-
-      beforeAll(async () => {
-
-        const postQuery = new GraphQLInteraction()
-          .given('there\'s a server error')
-          .uponReceiving('a request to get a single post')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetPost')
-          .withQuery(
-            `query GetPost($id: ID!) {
+                                       )
+                                       .withVariables({
+                                               id: '8f75eba5-6989-4dd3-b466-e464546ce374'
+                                       })
+                                       .willRespondWith({
+                                               status: 200,
+                                               headers: {
+                                                       'Content-Type': 'application/json; charset=utf-8'
+                                               },
+                                               body: {
+                                                       data: {
+                                                               post: null
+                                                       }
+                                               }
+                                       });
+                               return await internals.provider.addInteraction(postQuery);
+                       });
+
+                       test('it returns the post', async () => {
+                               const post = getPost('8f75eba5-6989-4dd3-b466-e464546ce374');
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               post.subscribe((postValue) => {
+                                       response = postValue;
+                                       counter();
+                               });
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(false);
+                               expect(response.error).toBe(undefined);
+                       });
+               });
+       });
+
+       describe("When there's a server error", () => {
+               describe('GetPost', () => {
+                       beforeAll(async () => {
+                               const postQuery = new GraphQLInteraction()
+                                       .given("there's a server error")
+                                       .uponReceiving('a request to get a single post')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetPost')
+                                       .withQuery(
+                                               `query GetPost($id: ID!) {
               post(id: $id) {
                 id
                 text
@@ -232,53 +217,48 @@ describe('Posts store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({
-            id: '8f75eba5-6989-4dd3-b466-e464546ce374'
-          })
-          .willRespondWith({
-            status: 500
-          });
-        return await internals.provider.addInteraction(postQuery);
-      });
-
-      test('it returns the error', async () => {
-
-        const post = getPost('8f75eba5-6989-4dd3-b466-e464546ce374');
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        post.subscribe((postValue) => {
-
-          response = postValue;
-          counter();
-        });
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(false);
-        expect(response.error).toBeInstanceOf(Error);
-      });
-    });
-  });
-
-  describe('When there\'s an error in the response', () => {
-
-    describe('GetPost', () => {
-
-      beforeAll(async () => {
-
-        const postQuery = new GraphQLInteraction()
-          .given('there\'s an error in the response')
-          .uponReceiving('a request to get a single post')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetPost')
-          .withQuery(
-            `query GetPost($id: ID!) {
+                                       )
+                                       .withVariables({
+                                               id: '8f75eba5-6989-4dd3-b466-e464546ce374'
+                                       })
+                                       .willRespondWith({
+                                               status: 500
+                                       });
+                               return await internals.provider.addInteraction(postQuery);
+                       });
+
+                       test('it returns the error', async () => {
+                               const post = getPost('8f75eba5-6989-4dd3-b466-e464546ce374');
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               post.subscribe((postValue) => {
+                                       response = postValue;
+                                       counter();
+                               });
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(false);
+                               expect(response.error).toBeInstanceOf(Error);
+                       });
+               });
+       });
+
+       describe("When there's an error in the response", () => {
+               describe('GetPost', () => {
+                       beforeAll(async () => {
+                               const postQuery = new GraphQLInteraction()
+                                       .given("there's an error in the response")
+                                       .uponReceiving('a request to get a single post')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetPost')
+                                       .withQuery(
+                                               `query GetPost($id: ID!) {
               post(id: $id) {
                 id
                 text
@@ -296,44 +276,46 @@ describe('Posts store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({
-            id: '8f75eba5-6989-4dd3-b466-e464546ce374'
-          })
-          .willRespondWith({
-            status: 200,
-            headers: {
-              'Content-Type': 'application/json; charset=utf-8'
-            },
-            body: {
-              errors: eachLike({
-                message: like('An error occurred when fetching the post')
-              })
-            }
-          });
-        return await internals.provider.addInteraction(postQuery);
-      });
-
-      test('it returns the error', async () => {
-
-        const post = getPost('8f75eba5-6989-4dd3-b466-e464546ce374');
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        post.subscribe((postValue) => {
-
-          response = postValue;
-          counter();
-        });
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(false);
-        expect(response.error.graphQLErrors).toEqual(expect.arrayContaining([{
-          message: 'An error occurred when fetching the post'
-        }]));
-      });
-    });
-  });
+                                       )
+                                       .withVariables({
+                                               id: '8f75eba5-6989-4dd3-b466-e464546ce374'
+                                       })
+                                       .willRespondWith({
+                                               status: 200,
+                                               headers: {
+                                                       'Content-Type': 'application/json; charset=utf-8'
+                                               },
+                                               body: {
+                                                       errors: eachLike({
+                                                               message: like('An error occurred when fetching the post')
+                                                       })
+                                               }
+                                       });
+                               return await internals.provider.addInteraction(postQuery);
+                       });
+
+                       test('it returns the error', async () => {
+                               const post = getPost('8f75eba5-6989-4dd3-b466-e464546ce374');
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               post.subscribe((postValue) => {
+                                       response = postValue;
+                                       counter();
+                               });
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(false);
+                               expect(response.error.graphQLErrors).toEqual(
+                                       expect.arrayContaining([
+                                               {
+                                                       message: 'An error occurred when fetching the post'
+                                               }
+                                       ])
+                               );
+                       });
+               });
+       });
 });
index 9d3eb5086d453d098acea346c4c19ecb9e33fdea..8c9effe1a1b498a5f7446fb715010da5433cb6ac 100644 (file)
@@ -10,43 +10,38 @@ jest.mock('$lib/config/config.ts');
 import { getTag } from './tags';
 
 const internals = {
-  provider: null
+       provider: null
 };
 
 describe('Tags store pact', () => {
-
-  beforeAll(async () => {
-
-    internals.provider = new Pact({
-      port: 1234,
-      dir: resolve(process.cwd(), 'pacts'),
-      consumer: 'ForumClient',
-      provider: 'ForumServer',
-      pactfileWriteMode: 'update'
-    });
-
-    await internals.provider.setup();
-  });
-
-  afterEach(() => internals.provider.verify());
-  afterAll(() => internals.provider.finalize());
-
-  describe('When there\'s data', () => {
-
-    describe('GetTag', () => {
-
-      beforeAll(async () => {
-
-        const tagQuery = new GraphQLInteraction()
-          .given('there\'s data')
-          .uponReceiving('a request to get a single tag')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetTag')
-          .withQuery(
-            `query GetTag($id: ID!) {
+       beforeAll(async () => {
+               internals.provider = new Pact({
+                       port: 1234,
+                       dir: resolve(process.cwd(), 'pacts'),
+                       consumer: 'ForumClient',
+                       provider: 'ForumServer',
+                       pactfileWriteMode: 'update'
+               });
+
+               await internals.provider.setup();
+       });
+
+       afterEach(() => internals.provider.verify());
+       afterAll(() => internals.provider.finalize());
+
+       describe("When there's data", () => {
+               describe('GetTag', () => {
+                       beforeAll(async () => {
+                               const tagQuery = new GraphQLInteraction()
+                                       .given("there's data")
+                                       .uponReceiving('a request to get a single tag')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetTag')
+                                       .withQuery(
+                                               `query GetTag($id: ID!) {
               tag(id: $id) {
                 id
                 topics {
@@ -59,77 +54,74 @@ describe('Tags store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({
-            id: 'pineapple'
-          })
-          .willRespondWith({
-            status: 200,
-            headers: {
-              'Content-Type': 'application/json; charset=utf-8'
-            },
-            body: {
-              data: {
-                tag: {
-                  id: like('pineapple'),
-                  topics: eachLike({
-                    id: like('cd038ae7-e8b4-4e38-9543-3d697e69ac34'),
-                    title: like('This topic is about pineapples'),
-                    updated_at: like(1619978944077),
-                    ttl: like(3555)
-                  })
-                }
-              }
-            }
-          });
-        return await internals.provider.addInteraction(tagQuery);
-      });
-
-      test('it returns the tag', async () => {
-
-        const tag = getTag('pineapple');
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        tag.subscribe((tagValue) => {
-
-          response = tagValue;
-          counter();
-        });
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data).toEqual({
-          id: 'pineapple',
-          topics: [{
-            id: 'cd038ae7-e8b4-4e38-9543-3d697e69ac34',
-            title: 'This topic is about pineapples',
-            updated_at: 1619978944077,
-            ttl: 3555
-          }]
-        });
-        expect(response.loading).toBe(false);
-        expect(response.error).toBe(undefined);
-      });
-    });
-  });
-
-  describe('When there\'s no data', () => {
-
-    describe('GetTag', () => {
-
-      beforeAll(async () => {
-
-        const tagQuery = new GraphQLInteraction()
-          .given('there\'s no data')
-          .uponReceiving('a request to get a single tag')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetTag')
-          .withQuery(
-            `query GetTag($id: ID!) {
+                                       )
+                                       .withVariables({
+                                               id: 'pineapple'
+                                       })
+                                       .willRespondWith({
+                                               status: 200,
+                                               headers: {
+                                                       'Content-Type': 'application/json; charset=utf-8'
+                                               },
+                                               body: {
+                                                       data: {
+                                                               tag: {
+                                                                       id: like('pineapple'),
+                                                                       topics: eachLike({
+                                                                               id: like('cd038ae7-e8b4-4e38-9543-3d697e69ac34'),
+                                                                               title: like('This topic is about pineapples'),
+                                                                               updated_at: like(1619978944077),
+                                                                               ttl: like(3555)
+                                                                       })
+                                                               }
+                                                       }
+                                               }
+                                       });
+                               return await internals.provider.addInteraction(tagQuery);
+                       });
+
+                       test('it returns the tag', async () => {
+                               const tag = getTag('pineapple');
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               tag.subscribe((tagValue) => {
+                                       response = tagValue;
+                                       counter();
+                               });
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data).toEqual({
+                                       id: 'pineapple',
+                                       topics: [
+                                               {
+                                                       id: 'cd038ae7-e8b4-4e38-9543-3d697e69ac34',
+                                                       title: 'This topic is about pineapples',
+                                                       updated_at: 1619978944077,
+                                                       ttl: 3555
+                                               }
+                                       ]
+                               });
+                               expect(response.loading).toBe(false);
+                               expect(response.error).toBe(undefined);
+                       });
+               });
+       });
+
+       describe("When there's no data", () => {
+               describe('GetTag', () => {
+                       beforeAll(async () => {
+                               const tagQuery = new GraphQLInteraction()
+                                       .given("there's no data")
+                                       .uponReceiving('a request to get a single tag')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetTag')
+                                       .withQuery(
+                                               `query GetTag($id: ID!) {
               tag(id: $id) {
                 id
                 topics {
@@ -142,61 +134,56 @@ describe('Tags store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({
-            id: 'pineapple'
-          })
-          .willRespondWith({
-            status: 200,
-            headers: {
-              'Content-Type': 'application/json; charset=utf-8'
-            },
-            body: {
-              data: {
-                tag: null
-              }
-            }
-          });
-        return await internals.provider.addInteraction(tagQuery);
-      });
-
-      test('it returns the tag', async () => {
-
-        const tag = getTag('pineapple');
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        tag.subscribe((tagValue) => {
-
-          response = tagValue;
-          counter();
-        });
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(false);
-        expect(response.error).toBe(undefined);
-      });
-    });
-  });
-
-  describe('When there\'s a server error', () => {
-
-    describe('GetTag', () => {
-
-      beforeAll(async () => {
-
-        const tagQuery = new GraphQLInteraction()
-          .given('there\'s a server error')
-          .uponReceiving('a request to get a single tag')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetTag')
-          .withQuery(
-            `query GetTag($id: ID!) {
+                                       )
+                                       .withVariables({
+                                               id: 'pineapple'
+                                       })
+                                       .willRespondWith({
+                                               status: 200,
+                                               headers: {
+                                                       'Content-Type': 'application/json; charset=utf-8'
+                                               },
+                                               body: {
+                                                       data: {
+                                                               tag: null
+                                                       }
+                                               }
+                                       });
+                               return await internals.provider.addInteraction(tagQuery);
+                       });
+
+                       test('it returns the tag', async () => {
+                               const tag = getTag('pineapple');
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               tag.subscribe((tagValue) => {
+                                       response = tagValue;
+                                       counter();
+                               });
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(false);
+                               expect(response.error).toBe(undefined);
+                       });
+               });
+       });
+
+       describe("When there's a server error", () => {
+               describe('GetTag', () => {
+                       beforeAll(async () => {
+                               const tagQuery = new GraphQLInteraction()
+                                       .given("there's a server error")
+                                       .uponReceiving('a request to get a single tag')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetTag')
+                                       .withQuery(
+                                               `query GetTag($id: ID!) {
               tag(id: $id) {
                 id
                 topics {
@@ -209,53 +196,48 @@ describe('Tags store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({
-            id: 'pineapple'
-          })
-          .willRespondWith({
-            status: 500
-          });
-        return await internals.provider.addInteraction(tagQuery);
-      });
-
-      test('it returns the error', async () => {
-
-        const tag = getTag('pineapple');
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        tag.subscribe((tagValue) => {
-
-          response = tagValue;
-          counter();
-        });
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(false);
-        expect(response.error).toBeInstanceOf(Error);
-      });
-    });
-  });
-
-  describe('When there\'s an error in the response', () => {
-
-    describe('GetTag', () => {
-
-      beforeAll(async () => {
-
-        const tagQuery = new GraphQLInteraction()
-          .given('there\'s an error in the response')
-          .uponReceiving('a request to get a single tag')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetTag')
-          .withQuery(
-            `query GetTag($id: ID!) {
+                                       )
+                                       .withVariables({
+                                               id: 'pineapple'
+                                       })
+                                       .willRespondWith({
+                                               status: 500
+                                       });
+                               return await internals.provider.addInteraction(tagQuery);
+                       });
+
+                       test('it returns the error', async () => {
+                               const tag = getTag('pineapple');
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               tag.subscribe((tagValue) => {
+                                       response = tagValue;
+                                       counter();
+                               });
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(false);
+                               expect(response.error).toBeInstanceOf(Error);
+                       });
+               });
+       });
+
+       describe("When there's an error in the response", () => {
+               describe('GetTag', () => {
+                       beforeAll(async () => {
+                               const tagQuery = new GraphQLInteraction()
+                                       .given("there's an error in the response")
+                                       .uponReceiving('a request to get a single tag')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetTag')
+                                       .withQuery(
+                                               `query GetTag($id: ID!) {
               tag(id: $id) {
                 id
                 topics {
@@ -268,44 +250,46 @@ describe('Tags store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({
-            id: 'pineapple'
-          })
-          .willRespondWith({
-            status: 200,
-            headers: {
-              'Content-Type': 'application/json; charset=utf-8'
-            },
-            body: {
-              errors: eachLike({
-                message: like('An error occurred when fetching the tag')
-              })
-            }
-          });
-        return await internals.provider.addInteraction(tagQuery);
-      });
-
-      test('it returns the error', async () => {
-
-        const tag = getTag('pineapple');
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        tag.subscribe((tagValue) => {
-
-          response = tagValue;
-          counter();
-        });
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(false);
-        expect(response.error.graphQLErrors).toEqual(expect.arrayContaining([{
-          message: 'An error occurred when fetching the tag'
-        }]));
-      });
-    });
-  });
+                                       )
+                                       .withVariables({
+                                               id: 'pineapple'
+                                       })
+                                       .willRespondWith({
+                                               status: 200,
+                                               headers: {
+                                                       'Content-Type': 'application/json; charset=utf-8'
+                                               },
+                                               body: {
+                                                       errors: eachLike({
+                                                               message: like('An error occurred when fetching the tag')
+                                                       })
+                                               }
+                                       });
+                               return await internals.provider.addInteraction(tagQuery);
+                       });
+
+                       test('it returns the error', async () => {
+                               const tag = getTag('pineapple');
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               tag.subscribe((tagValue) => {
+                                       response = tagValue;
+                                       counter();
+                               });
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(false);
+                               expect(response.error.graphQLErrors).toEqual(
+                                       expect.arrayContaining([
+                                               {
+                                                       message: 'An error occurred when fetching the tag'
+                                               }
+                                       ])
+                               );
+                       });
+               });
+       });
 });
index 2d2a2e7adba789b6a72b00dd2e3dfb4e1240f0e2..ad530540c0923ba3fb8afdef0c4ed5777cf88055 100644 (file)
@@ -10,43 +10,38 @@ jest.mock('$lib/config/config.ts');
 import { getTopic } from './topics';
 
 const internals = {
-  provider: null
+       provider: null
 };
 
 describe('Topics store pact', () => {
-
-  beforeAll(async () => {
-
-    internals.provider = new Pact({
-      port: 1234,
-      dir: resolve(process.cwd(), 'pacts'),
-      consumer: 'ForumClient',
-      provider: 'ForumServer',
-      pactfileWriteMode: 'update'
-    });
-
-    await internals.provider.setup();
-  });
-
-  afterEach(() => internals.provider.verify());
-  afterAll(() => internals.provider.finalize());
-
-  describe('When there\'s data', () => {
-
-    describe('GetTopic', () => {
-
-      beforeAll(async () => {
-
-        const topicQuery = new GraphQLInteraction()
-          .given('there\'s data')
-          .uponReceiving('a request to get a single topic')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetTopic')
-          .withQuery(
-            `query GetTopic($id: ID!) {
+       beforeAll(async () => {
+               internals.provider = new Pact({
+                       port: 1234,
+                       dir: resolve(process.cwd(), 'pacts'),
+                       consumer: 'ForumClient',
+                       provider: 'ForumServer',
+                       pactfileWriteMode: 'update'
+               });
+
+               await internals.provider.setup();
+       });
+
+       afterEach(() => internals.provider.verify());
+       afterAll(() => internals.provider.finalize());
+
+       describe("When there's data", () => {
+               describe('GetTopic', () => {
+                       beforeAll(async () => {
+                               const topicQuery = new GraphQLInteraction()
+                                       .given("there's data")
+                                       .uponReceiving('a request to get a single topic')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetTopic')
+                                       .withQuery(
+                                               `query GetTopic($id: ID!) {
               topic(id: $id) {
                 id
                 title
@@ -77,107 +72,106 @@ describe('Topics store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({
-            id: '0b58959d-d448-4a4e-84b6-35e5ac0028d1'
-          })
-          .willRespondWith({
-            status: 200,
-            headers: {
-              'Content-Type': 'application/json; charset=utf-8'
-            },
-            body: {
-              data: {
-                topic: {
-                  id: like('0b58959d-d448-4a4e-84b6-35e5ac0028d1'),
-                  title: like('The pacty topic of the day'),
-                  updated_at: like(1619979888906),
-                  ttl: like(3399),
-                  forum: {
-                    id: like('cucumber'),
-                    glyph: like('✽'),
-                    label: like('test_forums.cucumber')
-                  },
-                  tags: eachLike({
-                    id: like('skunk'),
-                    weight: like(44)
-                  }),
-                  posts: eachLike({
-                    id: like('ed93530e-6f9c-4701-91ef-14f9e0ed3e26'),
-                    text: like('The content of this post is very relevant'),
-                    created_at: like(1619979889798),
-                    author: like({
-                      id: like('07fb2ba0-0945-464a-b215-873296710c8c'),
-                      handle: like('cucumber_fan92')
-                    })
-                  })
-                }
-              }
-            }
-          });
-        return await internals.provider.addInteraction(topicQuery);
-      });
-
-      test('it returns the topic', async () => {
-
-        const topic = getTopic('0b58959d-d448-4a4e-84b6-35e5ac0028d1');
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        topic.subscribe((topicValue) => {
-
-          response = topicValue;
-          counter();
-        });
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data).toEqual({
-          id: '0b58959d-d448-4a4e-84b6-35e5ac0028d1',
-          title: 'The pacty topic of the day',
-          updated_at: 1619979888906,
-          ttl: 3399,
-          forum: {
-            id: 'cucumber',
-            glyph: '✽',
-            label: 'test_forums.cucumber'
-          },
-          tags: [{
-            id: 'skunk',
-            weight: 44
-          }],
-          posts: [{
-            id: 'ed93530e-6f9c-4701-91ef-14f9e0ed3e26',
-            text: 'The content of this post is very relevant',
-            created_at: 1619979889798,
-            author: {
-              id: '07fb2ba0-0945-464a-b215-873296710c8c',
-              handle: 'cucumber_fan92'
-            }
-          }]
-        });
-        expect(response.loading).toBe(false);
-        expect(response.error).toBe(undefined);
-      });
-    });
-  });
-
-  describe('When there\'s no data', () => {
-
-    describe('GetTopic', () => {
-
-      beforeAll(async () => {
-
-        const topicQuery = new GraphQLInteraction()
-          .given('there\'s no data')
-          .uponReceiving('a request to get a single topic')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetTopic')
-          .withQuery(
-            `query GetTopic($id: ID!) {
+                                       )
+                                       .withVariables({
+                                               id: '0b58959d-d448-4a4e-84b6-35e5ac0028d1'
+                                       })
+                                       .willRespondWith({
+                                               status: 200,
+                                               headers: {
+                                                       'Content-Type': 'application/json; charset=utf-8'
+                                               },
+                                               body: {
+                                                       data: {
+                                                               topic: {
+                                                                       id: like('0b58959d-d448-4a4e-84b6-35e5ac0028d1'),
+                                                                       title: like('The pacty topic of the day'),
+                                                                       updated_at: like(1619979888906),
+                                                                       ttl: like(3399),
+                                                                       forum: {
+                                                                               id: like('cucumber'),
+                                                                               glyph: like('✽'),
+                                                                               label: like('test_forums.cucumber')
+                                                                       },
+                                                                       tags: eachLike({
+                                                                               id: like('skunk'),
+                                                                               weight: like(44)
+                                                                       }),
+                                                                       posts: eachLike({
+                                                                               id: like('ed93530e-6f9c-4701-91ef-14f9e0ed3e26'),
+                                                                               text: like('The content of this post is very relevant'),
+                                                                               created_at: like(1619979889798),
+                                                                               author: like({
+                                                                                       id: like('07fb2ba0-0945-464a-b215-873296710c8c'),
+                                                                                       handle: like('cucumber_fan92')
+                                                                               })
+                                                                       })
+                                                               }
+                                                       }
+                                               }
+                                       });
+                               return await internals.provider.addInteraction(topicQuery);
+                       });
+
+                       test('it returns the topic', async () => {
+                               const topic = getTopic('0b58959d-d448-4a4e-84b6-35e5ac0028d1');
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               topic.subscribe((topicValue) => {
+                                       response = topicValue;
+                                       counter();
+                               });
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data).toEqual({
+                                       id: '0b58959d-d448-4a4e-84b6-35e5ac0028d1',
+                                       title: 'The pacty topic of the day',
+                                       updated_at: 1619979888906,
+                                       ttl: 3399,
+                                       forum: {
+                                               id: 'cucumber',
+                                               glyph: '✽',
+                                               label: 'test_forums.cucumber'
+                                       },
+                                       tags: [
+                                               {
+                                                       id: 'skunk',
+                                                       weight: 44
+                                               }
+                                       ],
+                                       posts: [
+                                               {
+                                                       id: 'ed93530e-6f9c-4701-91ef-14f9e0ed3e26',
+                                                       text: 'The content of this post is very relevant',
+                                                       created_at: 1619979889798,
+                                                       author: {
+                                                               id: '07fb2ba0-0945-464a-b215-873296710c8c',
+                                                               handle: 'cucumber_fan92'
+                                                       }
+                                               }
+                                       ]
+                               });
+                               expect(response.loading).toBe(false);
+                               expect(response.error).toBe(undefined);
+                       });
+               });
+       });
+
+       describe("When there's no data", () => {
+               describe('GetTopic', () => {
+                       beforeAll(async () => {
+                               const topicQuery = new GraphQLInteraction()
+                                       .given("there's no data")
+                                       .uponReceiving('a request to get a single topic')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetTopic')
+                                       .withQuery(
+                                               `query GetTopic($id: ID!) {
               topic(id: $id) {
                 id
                 title
@@ -208,61 +202,56 @@ describe('Topics store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({
-            id: '0b58959d-d448-4a4e-84b6-35e5ac0028d1'
-          })
-          .willRespondWith({
-            status: 200,
-            headers: {
-              'Content-Type': 'application/json; charset=utf-8'
-            },
-            body: {
-              data: {
-                topic: null
-              }
-            }
-          });
-        return await internals.provider.addInteraction(topicQuery);
-      });
-
-      test('it returns the topic', async () => {
-
-        const topic = getTopic('0b58959d-d448-4a4e-84b6-35e5ac0028d1');
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        topic.subscribe((topicValue) => {
-
-          response = topicValue;
-          counter();
-        });
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(false);
-        expect(response.error).toBe(undefined);
-      });
-    });
-  });
-
-  describe('When there\'s a server error', () => {
-
-    describe('GetTopic', () => {
-
-      beforeAll(async () => {
-
-        const topicQuery = new GraphQLInteraction()
-          .given('there\'s a server error')
-          .uponReceiving('a request to get a single topic')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetTopic')
-          .withQuery(
-            `query GetTopic($id: ID!) {
+                                       )
+                                       .withVariables({
+                                               id: '0b58959d-d448-4a4e-84b6-35e5ac0028d1'
+                                       })
+                                       .willRespondWith({
+                                               status: 200,
+                                               headers: {
+                                                       'Content-Type': 'application/json; charset=utf-8'
+                                               },
+                                               body: {
+                                                       data: {
+                                                               topic: null
+                                                       }
+                                               }
+                                       });
+                               return await internals.provider.addInteraction(topicQuery);
+                       });
+
+                       test('it returns the topic', async () => {
+                               const topic = getTopic('0b58959d-d448-4a4e-84b6-35e5ac0028d1');
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               topic.subscribe((topicValue) => {
+                                       response = topicValue;
+                                       counter();
+                               });
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(false);
+                               expect(response.error).toBe(undefined);
+                       });
+               });
+       });
+
+       describe("When there's a server error", () => {
+               describe('GetTopic', () => {
+                       beforeAll(async () => {
+                               const topicQuery = new GraphQLInteraction()
+                                       .given("there's a server error")
+                                       .uponReceiving('a request to get a single topic')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetTopic')
+                                       .withQuery(
+                                               `query GetTopic($id: ID!) {
               topic(id: $id) {
                 id
                 title
@@ -293,53 +282,48 @@ describe('Topics store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({
-            id: '0b58959d-d448-4a4e-84b6-35e5ac0028d1'
-          })
-          .willRespondWith({
-            status: 500
-          });
-        return await internals.provider.addInteraction(topicQuery);
-      });
-
-      test('it returns the error', async () => {
-
-        const topic = getTopic('0b58959d-d448-4a4e-84b6-35e5ac0028d1');
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        topic.subscribe((topicValue) => {
-
-          response = topicValue;
-          counter();
-        });
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(false);
-        expect(response.error).toBeInstanceOf(Error);
-      });
-    });
-  });
-
-  describe('When there\'s an error in the response', () => {
-
-    describe('GetTopic', () => {
-
-      beforeAll(async () => {
-
-        const topicQuery = new GraphQLInteraction()
-          .given('there\'s an error in the response')
-          .uponReceiving('a request to get a single topic')
-          .withRequest({
-            path: '/graphql',
-            method: 'POST'
-          })
-          .withOperation('GetTopic')
-          .withQuery(
-            `query GetTopic($id: ID!) {
+                                       )
+                                       .withVariables({
+                                               id: '0b58959d-d448-4a4e-84b6-35e5ac0028d1'
+                                       })
+                                       .willRespondWith({
+                                               status: 500
+                                       });
+                               return await internals.provider.addInteraction(topicQuery);
+                       });
+
+                       test('it returns the error', async () => {
+                               const topic = getTopic('0b58959d-d448-4a4e-84b6-35e5ac0028d1');
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               topic.subscribe((topicValue) => {
+                                       response = topicValue;
+                                       counter();
+                               });
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(false);
+                               expect(response.error).toBeInstanceOf(Error);
+                       });
+               });
+       });
+
+       describe("When there's an error in the response", () => {
+               describe('GetTopic', () => {
+                       beforeAll(async () => {
+                               const topicQuery = new GraphQLInteraction()
+                                       .given("there's an error in the response")
+                                       .uponReceiving('a request to get a single topic')
+                                       .withRequest({
+                                               path: '/graphql',
+                                               method: 'POST'
+                                       })
+                                       .withOperation('GetTopic')
+                                       .withQuery(
+                                               `query GetTopic($id: ID!) {
               topic(id: $id) {
                 id
                 title
@@ -370,44 +354,46 @@ describe('Topics store pact', () => {
                 __typename
               }
             }`
-          )
-          .withVariables({
-            id: '0b58959d-d448-4a4e-84b6-35e5ac0028d1'
-          })
-          .willRespondWith({
-            status: 200,
-            headers: {
-              'Content-Type': 'application/json; charset=utf-8'
-            },
-            body: {
-              errors: eachLike({
-                message: like('An error occurred when fetching the topic')
-              })
-            }
-          });
-        return await internals.provider.addInteraction(topicQuery);
-      });
-
-      test('it returns the error', async () => {
-
-        const topic = getTopic('0b58959d-d448-4a4e-84b6-35e5ac0028d1');
-        const { counter, promise: resolveAfterTwo } = resolveAfter(2);
-        let response = null;
-        topic.subscribe((topicValue) => {
-
-          response = topicValue;
-          counter();
-        });
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(true);
-        expect(response.error).toBe(undefined);
-        await resolveAfterTwo;
-        expect(response.data).toBe(null);
-        expect(response.loading).toBe(false);
-        expect(response.error.graphQLErrors).toEqual(expect.arrayContaining([{
-          message: 'An error occurred when fetching the topic'
-        }]));
-      });
-    });
-  });
+                                       )
+                                       .withVariables({
+                                               id: '0b58959d-d448-4a4e-84b6-35e5ac0028d1'
+                                       })
+                                       .willRespondWith({
+                                               status: 200,
+                                               headers: {
+                                                       'Content-Type': 'application/json; charset=utf-8'
+                                               },
+                                               body: {
+                                                       errors: eachLike({
+                                                               message: like('An error occurred when fetching the topic')
+                                                       })
+                                               }
+                                       });
+                               return await internals.provider.addInteraction(topicQuery);
+                       });
+
+                       test('it returns the error', async () => {
+                               const topic = getTopic('0b58959d-d448-4a4e-84b6-35e5ac0028d1');
+                               const { counter, promise: resolveAfterTwo } = resolveAfter(2);
+                               let response = null;
+                               topic.subscribe((topicValue) => {
+                                       response = topicValue;
+                                       counter();
+                               });
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(true);
+                               expect(response.error).toBe(undefined);
+                               await resolveAfterTwo;
+                               expect(response.data).toBe(null);
+                               expect(response.loading).toBe(false);
+                               expect(response.error.graphQLErrors).toEqual(
+                                       expect.arrayContaining([
+                                               {
+                                                       message: 'An error occurred when fetching the topic'
+                                               }
+                                       ])
+                               );
+                       });
+               });
+       });
 });
index 84228cd6cb41f4023b58a6f77f2f6e4480ce4a68..8d69d801341d7ba2da5d4e642b7901a27038f3d5 100644 (file)
@@ -1,4 +1,5 @@
 import { store } from './apollo';
 import { GET_TOPIC } from '$lib/data/queries';
 
-export const getTopic = (id: string) => store({ key: 'topic', query: GET_TOPIC, variables: { id } });
+export const getTopic = (id: string) =>
+       store({ key: 'topic', query: GET_TOPIC, variables: { id } });
index 5f57a2a3be2ec3aed673c8bae6e7e0df7a0aa600..e791babe4dd12bb13259254535c88dfeff978daf 100644 (file)
@@ -2,67 +2,55 @@ import { getGlyphHash } from './glyph_hash';
 import type { GlyphHash } from './glyph_hash';
 
 type TestState = {
-  glyphHash?: GlyphHash
+       glyphHash?: GlyphHash;
 };
 
-
 describe('Glyph Hash utility', () => {
-
-  test('it throws an exception if the string is too short', () => {
-
-    expect(() => {
-
-      getGlyphHash('short');
-    }).toThrow();
-
-    expect(() => {
-
-      getGlyphHash('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
-    }).toThrow();
-
-    expect(() => {
-
-      getGlyphHash('abcdefghijklmnopqrstuvwxyzABCDEF');
-    }).not.toThrow();
-  });
-
-  test('it treats UUIDs with hyphens the same as those without', () => {
-
-    const uuidWithHyphens = 'f7722355-2285-46c0-a55f-3483a826f3a6';
-    const uuidWithoutHyphens = 'f7722355228546c0a55f3483a826f3a6';
-
-    expect(getGlyphHash(uuidWithHyphens)).toEqual(getGlyphHash(uuidWithoutHyphens));
-  });
-
-  describe('it generates four sets of glyphs and colors', () => {
-
-    const state: TestState = {};
-
-    beforeEach(() => {
-
-      state.glyphHash = getGlyphHash('f7722355-2285-46c0-a55f-3483a826f3a6');
-    });
-
-    test('there should be four glyph fragments', () => {
-
-      expect(state.glyphHash.length).toBe(4);
-    });
-
-    test('each fragment should have a single character glyph', () => {
-
-      for (const glyphHashFragment of state.glyphHash) {
-        expect(typeof glyphHashFragment.glyph).toBe('string');
-        expect(glyphHashFragment.glyph.length).toBe(1);
-      }
-    });
-
-    test('each fragment should have a hexadecimal color', () => {
-
-      for (const glyphHashFragment of state.glyphHash) {
-        expect(typeof glyphHashFragment.color).toBe('string');
-        expect(glyphHashFragment.color.length).toBe(7);
-        expect(glyphHashFragment.color).toEqual(expect.stringMatching(/#[0-9a-f]{6}/));
-      }
-    });
-  });
+       test('it throws an exception if the string is too short', () => {
+               expect(() => {
+                       getGlyphHash('short');
+               }).toThrow();
+
+               expect(() => {
+                       getGlyphHash('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
+               }).toThrow();
+
+               expect(() => {
+                       getGlyphHash('abcdefghijklmnopqrstuvwxyzABCDEF');
+               }).not.toThrow();
+       });
+
+       test('it treats UUIDs with hyphens the same as those without', () => {
+               const uuidWithHyphens = 'f7722355-2285-46c0-a55f-3483a826f3a6';
+               const uuidWithoutHyphens = 'f7722355228546c0a55f3483a826f3a6';
+
+               expect(getGlyphHash(uuidWithHyphens)).toEqual(getGlyphHash(uuidWithoutHyphens));
+       });
+
+       describe('it generates four sets of glyphs and colors', () => {
+               const state: TestState = {};
+
+               beforeEach(() => {
+                       state.glyphHash = getGlyphHash('f7722355-2285-46c0-a55f-3483a826f3a6');
+               });
+
+               test('there should be four glyph fragments', () => {
+                       expect(state.glyphHash.length).toBe(4);
+               });
+
+               test('each fragment should have a single character glyph', () => {
+                       for (const glyphHashFragment of state.glyphHash) {
+                               expect(typeof glyphHashFragment.glyph).toBe('string');
+                               expect(glyphHashFragment.glyph.length).toBe(1);
+                       }
+               });
+
+               test('each fragment should have a hexadecimal color', () => {
+                       for (const glyphHashFragment of state.glyphHash) {
+                               expect(typeof glyphHashFragment.color).toBe('string');
+                               expect(glyphHashFragment.color.length).toBe(7);
+                               expect(glyphHashFragment.color).toEqual(expect.stringMatching(/#[0-9a-f]{6}/));
+                       }
+               });
+       });
 });
index b70456952184571e472bf529056c698e48df5e6e..7ac6448460d13e4f2256160cdc34996c44a7b344 100644 (file)
@@ -1,55 +1,37 @@
 export type GlyphHash = GlyphHashFragment[];
 type GlyphHashFragment = {
-  glyph: string,
-  color: string
+       glyph: string;
+       color: string;
 };
 
 const internals = {
-  kDehyphenRegex: /[-]/g,
-  kSplitterRegex: /.{1,8}/g,
-  kGlyphs: [
-    '☽',
-    '☆',
-    '♢',
-    '♡',
-    '╱',
-    '╲',
-    '╳',
-    '〰',
-    '▷',
-    '⏊',
-    '〒',
-    '▢',
-    '◯',
-    '⏃',
-    '⏀',
-    '⏆'
-  ],
-  unexpectedUUIDLength: class UnexpectedUUIDLength extends Error {
-    name = 'UnexpectedUUIDLength';
-    message = 'The provided string was not a valid UUIDv4, please provide a 32 character long string'
-  }
+       kDehyphenRegex: /[-]/g,
+       kSplitterRegex: /.{1,8}/g,
+       kGlyphs: ['☽', '☆', '♢', '♡', '╱', '╲', '╳', '〰', '▷', '⏊', '〒', '▢', '◯', '⏃', '⏀', '⏆'],
+       unexpectedUUIDLength: class UnexpectedUUIDLength extends Error {
+               name = 'UnexpectedUUIDLength';
+               message =
+                       'The provided string was not a valid UUIDv4, please provide a 32 character long string';
+       }
 };
 
 // Return a glyph with color based on a 4 byte fragment of a UUIDv4
 const getGlyphHashFragment = function (uuidFragment: string): GlyphHashFragment {
-
-  const glyphIndex = parseInt(uuidFragment.substring(0, 2), 16) % 16;
-  return {
-    glyph: internals.kGlyphs[glyphIndex],
-    color: `#${uuidFragment.substring(2, 8)}`
-  };
+       const glyphIndex = parseInt(uuidFragment.substring(0, 2), 16) % 16;
+       return {
+               glyph: internals.kGlyphs[glyphIndex],
+               color: `#${uuidFragment.substring(2, 8)}`
+       };
 };
 
 // Return an array of glyphs based on a UUIDv4
 export const getGlyphHash = function (uuid: string): GlyphHash {
+       const dehyphenedUuid = uuid.replace(/[-]/g, '');
 
-  const dehyphenedUuid = uuid.replace(/[-]/g, '');
-
-  if (dehyphenedUuid.length !== 32) {
-    throw new internals.unexpectedUUIDLength();
-  }
+       if (dehyphenedUuid.length !== 32) {
+               throw new internals.unexpectedUUIDLength();
+       }
 
-  const hashFragments = dehyphenedUuid.match(internals.kSplitterRegex);
-  return hashFragments.map(getGlyphHashFragment);
+       const hashFragments = dehyphenedUuid.match(internals.kSplitterRegex);
+       return hashFragments.map(getGlyphHashFragment);
 };
index 5d8ba271e9daa03e2e1db6339b05350d4116b38e..6c4b4d4880c62559f1cd41655a7d2439af41d8a9 100644 (file)
@@ -1,83 +1,71 @@
 import { readableTime } from './readable_time';
 
 describe('readableTime', () => {
+       test('it shows negative time as 0', () => {
+               const response = readableTime(-1000);
 
-  test('it shows negative time as 0', () => {
+               expect(response.count).toBe(0);
+               expect(response.label).toContain('seconds');
+       });
 
-    const response = readableTime(-1000);
+       test('uses seconds as the smallest unit', () => {
+               const response = readableTime(10);
 
-    expect(response.count).toBe(0);
-    expect(response.label).toContain('seconds');
-  });
+               expect(response.count).toBe(0);
+               expect(response.label).toContain('seconds');
+       });
 
-  test('uses seconds as the smallest unit', () => {
+       test('correctly divides miliseconds into seconds', () => {
+               const response = readableTime(4000);
 
-    const response = readableTime(10);
+               expect(response.count).toBe(4);
+       });
 
-    expect(response.count).toBe(0);
-    expect(response.label).toContain('seconds');
-  });
+       test('uses seconds if the time is < 1 minute', () => {
+               const response = readableTime(59 * 1000);
 
-  test('correctly divides miliseconds into seconds', () => {
+               expect(response.label).toContain('seconds');
+       });
 
-    const response = readableTime(4000);
+       test('correctly divides miliseconds into minutes', () => {
+               const response = readableTime(2 * 60 * 1000);
 
-    expect(response.count).toBe(4);
-  });
+               expect(response.count).toBe(2);
+       });
 
-  test('uses seconds if the time is < 1 minute', () => {
+       test('uses minutes if the time is < 1 hour', () => {
+               const response = readableTime(59 * 60 * 1000);
 
-    const response = readableTime(59 * 1000);
+               expect(response.label).toContain('minutes');
+       });
 
-    expect(response.label).toContain('seconds');
-  });
+       test('correctly divides miliseconds into hours', () => {
+               const response = readableTime(2 * 60 * 60 * 1000);
 
-  test('correctly divides miliseconds into minutes', () => {
+               expect(response.count).toBe(2);
+       });
 
-    const response = readableTime(2 * 60 * 1000);
+       test('uses hours if the time is < 1 days', () => {
+               const response = readableTime(23 * 60 * 60 * 1000);
 
-    expect(response.count).toBe(2);
-  });
+               expect(response.label).toContain('hours');
+       });
 
-  test('uses minutes if the time is < 1 hour', () => {
+       test('correctly divides miliseconds into days', () => {
+               const response = readableTime(2 * 24 * 60 * 60 * 1000);
 
-    const response = readableTime(59 * 60 * 1000);
+               expect(response.count).toBe(2);
+       });
 
-    expect(response.label).toContain('minutes');
-  });
+       test('uses days if the time is >= 1 day', () => {
+               const response = readableTime(364 * 24 * 60 * 60 * 1000);
 
-  test('correctly divides miliseconds into hours', () => {
+               expect(response.label).toContain('days');
+       });
 
-    const response = readableTime(2 * 60 * 60 * 1000);
+       test('uses days as the maximum unit', () => {
+               const response = readableTime(Number.MAX_VALUE);
 
-    expect(response.count).toBe(2);
-  });
-
-  test('uses hours if the time is < 1 days', () => {
-
-    const response = readableTime(23 * 60 * 60 * 1000);
-
-    expect(response.label).toContain('hours');
-  });
-
-  test('correctly divides miliseconds into days', () => {
-
-    const response = readableTime(2 * 24 * 60 * 60 * 1000);
-
-    expect(response.count).toBe(2);
-  });
-
-  test('uses days if the time is >= 1 day', () => {
-
-    const response = readableTime(364 * 24 * 60 * 60 * 1000);
-
-    expect(response.label).toContain('days');
-  });
-
-  test('uses days as the maximum unit', () => {
-
-    const response = readableTime(Number.MAX_VALUE);
-
-    expect(response.label).toContain('days');
-  });
+               expect(response.label).toContain('days');
+       });
 });
index 86ba044843514d01a4027d2587c10e01ee8111a3..c949981aa96afe17aeb1f377bd4206407d896e3d 100644 (file)
@@ -1,46 +1,43 @@
 type DateMagnitude = 'day' | 'hour' | 'minute' | 'second';
 
 type ReadableTime = {
-  count: number,
-  label: string
+       count: number;
+       label: string;
 };
 
-
 const internals = {
-  magnitudes: {
-    day: 86400000,
-    hour: 3600000,
-    minute: 60000,
-    second: 1000
-  },
-  labels: {
-    day: 'time.days',
-    hour: 'time.hours',
-    minute: 'time.minutes',
-    second: 'time.seconds'
-  },
-
-  makeTimeReadable(time: number, magnitude: DateMagnitude): ReadableTime {
+       magnitudes: {
+               day: 86400000,
+               hour: 3600000,
+               minute: 60000,
+               second: 1000
+       },
+       labels: {
+               day: 'time.days',
+               hour: 'time.hours',
+               minute: 'time.minutes',
+               second: 'time.seconds'
+       },
 
-    return {
-      count: Math.floor(time / internals.magnitudes[magnitude]),
-      label: internals.labels[magnitude]
-    };
-  }
+       makeTimeReadable(time: number, magnitude: DateMagnitude): ReadableTime {
+               return {
+                       count: Math.floor(time / internals.magnitudes[magnitude]),
+                       label: internals.labels[magnitude]
+               };
+       }
 };
 
 export const readableTime = function readableTime(time: number): ReadableTime {
-
-  switch (true) {
-  case time >= internals.magnitudes.day:
-    return internals.makeTimeReadable(time, 'day');
-  case time >= internals.magnitudes.hour:
-    return internals.makeTimeReadable(time, 'hour');
-  case time >= internals.magnitudes.minute:
-    return internals.makeTimeReadable(time, 'minute');
-  case time < 0:
-    return internals.makeTimeReadable(0, 'second');
-  default:
-    return internals.makeTimeReadable(time, 'second');
-  }
+       switch (true) {
+               case time >= internals.magnitudes.day:
+                       return internals.makeTimeReadable(time, 'day');
+               case time >= internals.magnitudes.hour:
+                       return internals.makeTimeReadable(time, 'hour');
+               case time >= internals.magnitudes.minute:
+                       return internals.makeTimeReadable(time, 'minute');
+               case time < 0:
+                       return internals.makeTimeReadable(0, 'second');
+               default:
+                       return internals.makeTimeReadable(time, 'second');
+       }
 };
index 7e0cc3c5d0a671956d3939abb74d2f243b302fe4..4b30d3cc864ceb887a30f0cf72304f22329ed259 100644 (file)
@@ -1,37 +1,30 @@
 import { resolveAfter } from './resolve_after';
 
 describe('Resolve After', () => {
-
-  test('it should throw if given 0', () => {
-
-    expect(() => {
-
-      resolveAfter(0);
-    }).toThrow();
-  });
-
-  test('it should throw if given a negative number', () => {
-
-    expect(() => {
-
-      resolveAfter(-1);
-    }).toThrow();
-  });
-
-  test('it should resolve after the specified number of times', () => {
-
-    expect(() => {
-
-      const { counter, promise: resolveAfterThree } = resolveAfter(3);
-      let resolved = false;
-
-      resolveAfterThree.then(() => (resolved = true));
-      counter();
-      expect(resolved).toBe(false);
-      counter();
-      expect(resolved).toBe(false);
-      counter();
-      expect(resolved).toBe(true);
-    }).toThrow();
-  });
+       test('it should throw if given 0', () => {
+               expect(() => {
+                       resolveAfter(0);
+               }).toThrow();
+       });
+
+       test('it should throw if given a negative number', () => {
+               expect(() => {
+                       resolveAfter(-1);
+               }).toThrow();
+       });
+
+       test('it should resolve after the specified number of times', () => {
+               expect(() => {
+                       const { counter, promise: resolveAfterThree } = resolveAfter(3);
+                       let resolved = false;
+
+                       resolveAfterThree.then(() => (resolved = true));
+                       counter();
+                       expect(resolved).toBe(false);
+                       counter();
+                       expect(resolved).toBe(false);
+                       counter();
+                       expect(resolved).toBe(true);
+               }).toThrow();
+       });
 });
index 95a477e1bdf2f2c7c9e6c7211c7891014535ef6c..5d35f1c4b906c28c948df0749ab4e18b40c477f8 100644 (file)
@@ -1,29 +1,26 @@
 export type ResolveAfterPromise = {
-  counter: () => void,
-  promise: Promise<void>
+       counter: () => void;
+       promise: Promise<void>;
 };
 
 export const resolveAfter = function (timesUntilResolve: number): ResolveAfterPromise {
+       let counter = null;
+       let currentValue = 0;
 
-  let counter = null;
-  let currentValue = 0;
+       if (timesUntilResolve <= 0) {
+               throw new Error('Resolve after requires a positive integer');
+       }
 
-  if (timesUntilResolve <= 0) {
-    throw new Error('Resolve after requires a positive integer');
-  }
+       const promise: Promise<void> = new Promise((resolvePromise) => {
+               counter = () => {
+                       if (++currentValue === timesUntilResolve) {
+                               resolvePromise();
+                       }
+               };
+       });
 
-  const promise: Promise<void> = new Promise((resolvePromise) => {
-
-    counter = () => {
-
-      if (++currentValue === timesUntilResolve) {
-        resolvePromise();
-      }
-    };
-  });
-
-  return {
-    counter,
-    promise
-  };
+       return {
+               counter,
+               promise
+       };
 };
index 737fc1ecec45fcd272a1ccef23b0438cbd976457..f0620d3b403f0bb926057329f9b6550fd5473e5d 100644 (file)
@@ -1,4 +1,4 @@
-<script>
+<script lang="ts">
        import InvalidRoute from '$lib/components/invalid_route/invalid_route.svelte';
 </script>
 
index b856e214daa128a99772412475154de333fefff4..62881f25defb19d3752c9152263788844e2e854d 100644 (file)
@@ -1,5 +1,5 @@
-<script>
-  import "../app.css";
+<script lang="ts">
+       import '../app.css';
        import '$lib/i18n';
 
        import { isLoading } from 'svelte-i18n';
        <main>
                <slot />
        </main>
-  <nav title={$_('forum_list.title')}>
-    {#if $store.loading}
-      <Loader />
-    {/if}
-    {#if $store.error}
-      <ErrorBlock message={$_('forum_list.error.unavailable')} />
-    {/if}
-    {#if forums}
-      <ForumList forums={forums} />
-    {/if}
-  </nav>
+       <nav title={$_('forum_list.title')}>
+               {#if $store.loading}
+                       <Loader />
+               {/if}
+               {#if $store.error}
+                       <ErrorBlock message={$_('forum_list.error.unavailable')} />
+               {/if}
+               {#if forums}
+                       <ForumList {forums} />
+               {/if}
+       </nav>
        <Footer />
 {/if}
 
index 1eef1dcda62779192b105d0e46d94b55d29ac85b..aeca1421d8ef438c95660f88ccd47fa819adb8d2 100644 (file)
@@ -1,12 +1,12 @@
-<script context="module">
+<script lang="ts" context="module">
        export const load = ({
-         page: {
-           params: { id }
-         }
+               page: {
+                       params: { id }
+               }
        }) => ({ props: { id } });
 </script>
 
-<script>
+<script lang="ts">
        import Author from '$lib/components/author/author.svelte';
 </script>
 
index eb65c22c7446d697309e26eee97e844295ff4a2e..b235e21ecb02d58d12a94a53651d9d4c0fb65cfa 100644 (file)
@@ -1,12 +1,12 @@
-<script context="module">
+<script lang="ts" context="module">
        export const load = ({
-         page: {
-           params: { id }
-         }
+               page: {
+                       params: { id }
+               }
        }) => ({ props: { id } });
 </script>
 
-<script>
+<script lang="ts">
        import { _ } from 'svelte-i18n';
        import Forum from '$lib/components/forum/forum.svelte';
        import ErrorBlock from '$lib/components/error_block/error_block.svelte';
index a822738721b86328a29e0f052fc0bf169fc39d3b..a82e48825f66a659387932e330a2ecdaeb2f545f 100644 (file)
@@ -1,12 +1,12 @@
-<script context="module">
+<script lang="ts" context="module">
        export const load = ({
-         page: {
-           params: { id }
-         }
+               page: {
+                       params: { id }
+               }
        }) => ({ props: { id } });
 </script>
 
-<script>
+<script lang="ts">
        import { _ } from 'svelte-i18n';
        import { getTag } from '$lib/stores/tags';
        import ErrorBlock from '$lib/components/error_block/error_block.svelte';
index f5fa06f8b61d268e65a620e69b3622c49b85925f..dad925366cc2438d10e6bec51225620b6e0a3c9b 100644 (file)
@@ -1,4 +1,4 @@
-<script>
+<script lang="ts">
        import { _ } from 'svelte-i18n';
        import Loader from '$lib/components/loader/loader.svelte';
 </script>
index 38bdb49aefaae64bb71e44c4139467141126ae53..82d8045a7c8c71d88bbd6f80ce33949d4fafa2d1 100644 (file)
@@ -1,12 +1,12 @@
-<script context="module">
+<script lang="ts" context="module">
        export const load = ({
-         page: {
-           params: { id }
-         }
+               page: {
+                       params: { id }
+               }
        }) => ({ props: { id } });
 </script>
 
-<script>
+<script lang="ts">
        import { _ } from 'svelte-i18n';
        import { getPost } from '$lib/stores/posts';
        import Post from '$lib/components/post/post.svelte';
index 510ced147cbd80008250c1afe9574f5a470e83cb..e04f473a001375f5ea6506db5e2133fe5f5db6f2 100644 (file)
@@ -1,12 +1,12 @@
-<script context="module">
+<script lang="ts" context="module">
        export const load = ({
-         page: {
-           params: { id }
-         }
+               page: {
+                       params: { id }
+               }
        }) => ({ props: { id } });
 </script>
 
-<script>
+<script lang="ts">
        import { onDestroy } from 'svelte';
        import { _ } from 'svelte-i18n';
        import { getTopic } from '$lib/stores/topics';
index 589563583b13b83d033400927df0b45036a6b338..54c3ccb1c78b1286d717fdd68831532edb96080b 100644 (file)
@@ -1,16 +1,17 @@
 main {
-  grid-column: col-start 2 / span 11;
+       grid-column: col-start 2 / span 11;
 }
 
 #forum {
-  display: grid;
-  font-family : 'ヒラギノ明朝 ProN' , 'Hiragino Mincho ProN' , '游明朝','游明朝体',YuMincho,'Yu Mincho' , 'MS 明朝' , 'MS Mincho' , HiraMinProN-W3 , 'TakaoEx明朝' , TakaoExMincho , 'MotoyaLCedar' , 'Droid Sans Japanese' , serif;
-  grid-template-columns: repeat(12, [col-start] 1fr);
-  grid-gap: 20px;
-  grid-auto-rows: minmax(24px, auto);
+       display: grid;
+       font-family: 'ヒラギノ明朝 ProN', 'Hiragino Mincho ProN', '游明朝', '游明朝体', YuMincho,
+               'Yu Mincho', 'MS 明朝', 'MS Mincho', HiraMinProN-W3, 'TakaoEx明朝', TakaoExMincho,
+               'MotoyaLCedar', 'Droid Sans Japanese', serif;
+       grid-template-columns: repeat(12, [col-start] 1fr);
+       grid-gap: 20px;
+       grid-auto-rows: minmax(24px, auto);
 }
 
 body {
-  background-color: whitesmoke;
+       background-color: whitesmoke;
 }
-
index 68a60f752df3ae493a7ed6a39def2ee04df85ae3..b6bd70c7ba39750fb6d17574646f9336069a69a8 100644 (file)
@@ -1,7 +1,7 @@
 {
-  "name": "Forum",
-  "start_url": "/",
-  "background_color": "#ffffff",
-  "display": "standalone",
-  "theme_color": "#ffffff"
+       "name": "Forum",
+       "start_url": "/",
+       "background_color": "#ffffff",
+       "display": "standalone",
+       "theme_color": "#ffffff"
 }
index 23f07d20321151a2594edbb830aed0efa1e08377..892f0c467672d147a9755da05dbe04dd51b4fa15 100644 (file)
@@ -3,13 +3,13 @@ import preprocess from 'svelte-preprocess';
 
 /** @type {import('@sveltejs/kit').Config} */
 const config = {
-  // Consult https://github.com/sveltejs/svelte-preprocess
-  // for more information about preprocessors
-  preprocess: preprocess(),
+       // Consult https://github.com/sveltejs/svelte-preprocess
+       // for more information about preprocessors
+       preprocess: preprocess(),
 
-  kit: {
-    adapter: adapter()
-  }
+       kit: {
+               adapter: adapter()
+       }
 };
 
 export default config;
index 327f3df1187e5fd9d2df517915e20155c1f9b00f..790ce271379c0a15720151b2d3d17a7b937661c7 100644 (file)
@@ -1,6 +1,4 @@
 module.exports = {
-  content: ['./src/**/*.{html,js,svelte,ts}'],
-  plugins: [
-    require('@tailwindcss/typography'), require('daisyui')
-  ]
+       content: ['./src/**/*.{html,js,svelte,ts}'],
+       plugins: [require('@tailwindcss/typography'), require('daisyui')]
 };
index d42c069b41a6245b9fe36955f0eac93840a4a455..2dcd4a5804ce1f611cf947fef964464483a9a165 100644 (file)
@@ -1,7 +1,7 @@
 {
        "extends": "./.svelte-kit/tsconfig.json",
-  "compilerOptions": {
-    "resolveJsonModule": true,
-    "esModuleInterop": true
-  }
+       "compilerOptions": {
+               "resolveJsonModule": true,
+               "esModuleInterop": true
+       }
 }