Skip to content

Commit

Permalink
Merge pull request #69 from hasura/lyndon/external_dependencies_test
Browse files Browse the repository at this point in the history
Adding (currently ignored) test to verify behaviour of external dependency usage
  • Loading branch information
sordina authored Nov 20, 2023
2 parents cd79263 + 97ff795 commit 656c31f
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

.PHONY: help
help:
@echo Targets:
@cat Makefile | grep '^[a-zA-Z]' | sed 's/^/ * /; s/://'

test:
deno test -A src/test

test-and-watch:
deno test -A --watch src/test

serve:
@echo Note, this requires a config argument - Run the command directly.
deno run -A --watch --check src/mod.ts serve
9 changes: 9 additions & 0 deletions src/test/data/external_dependencies.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

import * as base64 from "https://denopkg.com/chiefbiiko/[email protected]/mod.ts";
import * as emojify from "npm:[email protected]";

export function test_deps(s: string): string {
const b64 = base64.fromUint8Array(new TextEncoder().encode(s));
const emo = emojify.emojify(":t-rex: :heart: NPM");
return `${b64} ${emo}`;
}
29 changes: 29 additions & 0 deletions src/test/external_dependencies_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

import * as test from "https://deno.land/[email protected]/assert/mod.ts";
import * as path from "https://deno.land/[email protected]/path/mod.ts";
import * as infer from '../infer.ts';

// Skipped due to NPM dependency resolution not currently being supported.
Deno.test({
name: "Inference",
ignore: true,
fn() {
const program_path = path.fromFileUrl(import.meta.resolve('./data/external_dependencies.ts'));
const vendor_path = path.fromFileUrl(import.meta.resolve('./vendor'));
const program_results = infer.programInfo(program_path, vendor_path, false);

test.assertEquals(program_results, {
positions: {
},
schema: {
scalar_types: {
},
object_types: {},
collections: [],
functions: [],
procedures: [
],
}
});
}
});

0 comments on commit 656c31f

Please sign in to comment.