Skip to content

Commit

Permalink
Add basic test and fix import issue with react server dom (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjrussell authored Jun 18, 2022
1 parent 2432073 commit 3105e5f
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ jobs:

- name: Build the project
run: npm run build

- name: Test the project
run: npm run test
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"build": "run-s build:*",
"build:spago": "spago build",
"build:pulp": "pulp build -o output-pulp",
"clean": "rm -rf .spago bower_components output output-pulp node_modules .pulp-cache .psci_modules"
"clean": "rm -rf .spago bower_components output output-pulp node_modules .pulp-cache .psci_modules",
"test": "spago -x test.dhall test"
}
}
2 changes: 1 addition & 1 deletion src/React/Basic/DOM/Server.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import ReactDOMServer from "react-dom/server";
import ReactDOMServer from "react-dom/server.js";
export var renderToString = ReactDOMServer.renderToString;
export var renderToStaticMarkup = ReactDOMServer.renderToStaticMarkup;
6 changes: 6 additions & 0 deletions test.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
let conf = ./spago.dhall

in conf // {
sources = conf.sources # [ "test/**/*.purs" ],
dependencies = conf.dependencies # [ "effect", "spec", "aff" ]
}
18 changes: 18 additions & 0 deletions test/Main.purs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module Test.Main where

import Prelude

import Effect (Effect)
import Effect.Aff (launchAff_)
import React.Basic.DOM.Server (renderToString)
import Test.Spec (describe, it)
import Test.Spec.Assertions (shouldEqual)
import Test.Spec.Reporter.Console (consoleReporter)
import Test.Spec.Runner (runSpec)

main :: Effect Unit
main = launchAff_ $ runSpec [consoleReporter] do
describe "react-basic-dom-spec" do
describe "react-basic-dom-server" do
it "imports properly" do
renderToString mempty `shouldEqual` ""

0 comments on commit 3105e5f

Please sign in to comment.