Skip to content

Commit

Permalink
Creating tests that show nulls not working!
Browse files Browse the repository at this point in the history
Run this with `deno task test`
  • Loading branch information
gilesdring committed Aug 28, 2024
1 parent e564b81 commit a4900b0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
3 changes: 2 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"build": "deno task vr provision && deno task lume",
"serve": "deno task lume -s",
"dev": "SMALL_SITE=true deno task serve",
"vr": "deno run -qA https://code.velociraptor.run"
"vr": "deno run -qA https://code.velociraptor.run",
"test": "deno test -A --unstable-ffi"
},
"compilerOptions": {
"types": [
Expand Down
34 changes: 34 additions & 0 deletions test/nulls.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { assertEquals } from "jsr:@std/assert";
import { duckDbLoader } from "jsr:@dringtech/[email protected]";

Deno.test('nulls should be returned for householdProjections', async () => {
const loader = duckDbLoader();
const dataItem = await loader('src/data/areas/place-page/_data/householdProjections.sql');
console.log(`${dataItem}`);
let res = dataItem('E06000028').find(x => x.date === 2023)!;
console.log(res);
assertEquals(res.HouseholdProjection, 86936);
assertEquals(res.AllVacants, null);
assertEquals(res.Dwellings, null);
assertEquals(res.LongTermVacants, null);

res = dataItem('E06000028').find(x => x.date === 2023)!;
console.log(res);
assertEquals(res.HouseholdProjection, 86936);
assertEquals(res.AllVacants, null);
assertEquals(res.Dwellings, null);
assertEquals(res.LongTermVacants, null);
})

Deno.test('nulls should be returned for householdProjections', async () => {
const loader = duckDbLoader();
const dataItem = await loader('src/data/hexmaps/_data/housepriceratio.sql');
console.log(`${dataItem}`);
let res = dataItem();
assertEquals(res.find(x => x.geography_code === 'E09000001')!.value, null);
assertEquals(res.find(x => x.geography_code === 'E06000053')!.value, null);

res = dataItem();
assertEquals(res.find(x => x.geography_code === 'E09000001')!.value, null);
assertEquals(res.find(x => x.geography_code === 'E06000053')!.value, null);
})

0 comments on commit a4900b0

Please sign in to comment.