Skip to content

Commit 87b56a1

Browse files
committed
Add conformance test coverage
1 parent 9423f87 commit 87b56a1

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

.github/workflows/conformance.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ jobs:
3434
run: npm install
3535

3636
- name: Install conformance client
37-
uses: GoogleCloudPlatform/functions-framework-conformance/.github/actions/client/install@1975792fb34ebbfa058d690666186d669d3a5977 # v1.8.0
37+
uses: GoogleCloudPlatform/functions-framework-conformance/.github/actions/client/install@5f2a796b58f099d749e70ecc83f531f6701c64af # v1.8.3
3838
with:
39-
client-version: v1.7.0
39+
client-version: v1.8.3
4040
cache-path: ~/client
41-
cache-key: conformance-client-v1.7.0
41+
cache-key: conformance-client-v1.8.3
4242

4343
- name: Run HTTP conformance tests using legacy API
4444
working-directory: 'test/conformance'
@@ -73,6 +73,16 @@ jobs:
7373
-validate-mapping=false \
7474
-cmd="npm start -- --target=writeHttpDeclarative"
7575
76+
- name: Run Typed conformance tests using declarative API
77+
working-directory: 'test/conformance'
78+
run: |
79+
~/client \
80+
-type=http \
81+
-declarative-type=typed \
82+
-buildpacks=false \
83+
-validate-mapping=false \
84+
-cmd="npm start -- --target=writeTypedDeclarative"
85+
7686
- name: Run cloudevent conformance tests using declarative API
7787
working-directory: 'test/conformance'
7888
run: |

src/functions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ export class JsonInvocationFormat<T, U> implements InvocationFormat<T, U> {
206206
deserializeRequest(request: InvocationRequest): T {
207207
const body = request.body();
208208
if (typeof body !== 'string') {
209-
console.log(typeof body);
210209
throw new Error('Unsupported Content-Type, expected application/json');
211210
}
212211
try {

test/conformance/function.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ functions.http('writeHttpDeclarative', (req, res) => {
88
res.sendStatus(200);
99
});
1010

11+
functions.typed('writeTypedDeclarative', req => {
12+
return {
13+
payload: req,
14+
};
15+
});
16+
1117
functions.cloudEvent('writeCloudEventDeclarative', cloudEvent => {
1218
cloudEvent.datacontenttype = 'application/json';
1319
writeJson(cloudEvent);

0 commit comments

Comments
 (0)