Skip to content

Commit ed36ba2

Browse files
authored
Add website tests (#434)
1 parent f8561c0 commit ed36ba2

File tree

2 files changed

+34
-8
lines changed

2 files changed

+34
-8
lines changed

.github/workflows/test-website.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Test Website Builds
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
test-website:
10+
runs-on: ubuntu-latest
11+
container: node
12+
steps:
13+
- name: Harden Runner
14+
uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1
15+
with:
16+
egress-policy: audit
17+
18+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
19+
- run: npx envinfo
20+
- name: Build and Deploy
21+
env:
22+
NODE_OPTIONS: --openssl-legacy-provider
23+
working-directory: ./website
24+
run: |
25+
npm install
26+
npx gatsby build --prefix-paths

website/docs/special-topics/object-function-refs.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ This example code shows how to use the `FunctionReference` class.
4040

4141
### src/native-addon.h
4242

43-
[**native-addon.h**](https://github.com/nodejs/node-addon-examples/blob/main/src/4-references-and-handle-scope/function-reference-demo/src/native-addon.h)
43+
[**native-addon.h**](https://github.com/nodejs/node-addon-examples/blob/main/src/4-references-and-handle-scope/function-reference-demo/node-addon-api/src/native-addon.h)
4444

45-
`embed:src/4-references-and-handle-scope/function-reference-demo/src/native-addon.h`
45+
`embed:src/4-references-and-handle-scope/function-reference-demo/node-addon-api/src/native-addon.h`
4646

4747
The `NativeAddon` C++ class has two data members that are populated in the `NativeAddon` constructor:
4848

@@ -51,9 +51,9 @@ The `NativeAddon` C++ class has two data members that are populated in the `Nati
5151

5252
### src/native-addon.cc
5353

54-
[**native-addon.cc**](https://github.com/nodejs/node-addon-examples/blob/main/src/4-references-and-handle-scope/function-reference-demo/src/native-addon.cc)
54+
[**native-addon.cc**](https://github.com/nodejs/node-addon-examples/blob/main/src/4-references-and-handle-scope/function-reference-demo/node-addon-api/src/native-addon.cc)
5555

56-
`embed:src/4-references-and-handle-scope/function-reference-demo/src/native-addon.cc`
56+
`embed:src/4-references-and-handle-scope/function-reference-demo/node-addon-api/src/native-addon.cc`
5757

5858
The `NativeAddon` constructor, which is called from JavaScript, takes two function arguments. The first argument is stored as a `Napi::FunctionReference` and the second is stored as a `Napi::Function`.
5959

@@ -65,17 +65,17 @@ The `NativeAddon` class implements two methods which can be called from JavaScri
6565

6666
### src/binding.cc
6767

68-
[**binding.cc**](https://github.com/nodejs/node-addon-examples/blob/main/src/4-references-and-handle-scope/function-reference-demo/src/binding.cc)
68+
[**binding.cc**](https://github.com/nodejs/node-addon-examples/blob/main/src/4-references-and-handle-scope/function-reference-demo/node-addon-api/src/binding.cc)
6969

70-
`embed:src/4-references-and-handle-scope/function-reference-demo/src/binding.cc`
70+
`embed:src/4-references-and-handle-scope/function-reference-demo/node-addon-api/src/binding.cc`
7171

7272
This is a standard `binding.cc` file:
7373

7474
### index.js
7575

76-
[**index.js**](https://github.com/nodejs/node-addon-examples/blob/main/src/4-references-and-handle-scope/function-reference-demo/index.js)
76+
[**index.js**](https://github.com/nodejs/node-addon-examples/blob/main/src/4-references-and-handle-scope/function-reference-demo/node-addon-api/index.js)
7777

78-
`embed:src/4-references-and-handle-scope/function-reference-demo/index.js`
78+
`embed:src/4-references-and-handle-scope/function-reference-demo/node-addon-api/index.js`
7979

8080
This JavaScript code shows the use of the `NativeAddon` class. Note that the call to the native `tryCallByStoredFunction` method fails because the data member on which it relies is not valid.
8181

0 commit comments

Comments
 (0)