Skip to content

Commit 1cc73d0

Browse files
committed
Add Jest tests for importing/requiring react-on-rails
1 parent 5621e31 commit 1cc73d0

File tree

5 files changed

+1623
-6
lines changed

5 files changed

+1623
-6
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ jobs:
154154
run: cd spec/dummy && yalc add react-on-rails
155155
- name: Install Node modules with Yarn for dummy app
156156
run: cd spec/dummy && yarn install --no-progress --no-emoji
157+
- name: Dummy JS tests
158+
run: |
159+
cd spec/dummy
160+
yarn run test:js
157161
- name: Install Ruby Gems for package
158162
run: |
159163
bundle lock --add-platform 'x86_64-linux'

spec/dummy/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"expose-loader": "^1.0.3",
4646
"file-loader": "^6.2.0",
4747
"imports-loader": "^1.2.0",
48+
"jest": "^29.7.0",
4849
"react-refresh": "^0.11.0",
4950
"rescript": "^11.1.4",
5051
"sass": "^1.43.4",
@@ -68,6 +69,7 @@
6869
"link-source": "cd ../.. && yarn run build && yalc publish",
6970
"lint": "cd ../.. && yarn run lint",
7071
"format": "cd ../.. && yarn run nps format",
72+
"test:js": "yarn run jest tests",
7173
"test": "yarn run build:test && yarn run lint && bin/rspec",
7274
"build:test": "rm -rf public/webpack/test && yarn build:rescript && RAILS_ENV=test NODE_ENV=test bin/shakapacker",
7375
"build:dev": "rm -rf public/webpack/development && yarn build:rescript && RAILS_ENV=development NODE_ENV=development bin/shakapacker",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import ReactOnRails from 'react-on-rails';
2+
3+
test('ReactOnRails', () => {
4+
ReactOnRails.register({});
5+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const ReactOnRails = require('react-on-rails').default;
2+
3+
test('ReactOnRails', () => {
4+
ReactOnRails.register({});
5+
});

0 commit comments

Comments
 (0)