Use scalar and collection find specs in tests.js.
This commit is contained in:
parent
f775e67912
commit
b8a3f5fe2b
1 changed files with 3 additions and 5 deletions
|
@ -38,9 +38,7 @@ async function testOpen() {
|
||||||
console.log("Transaction instant: " + txResult.txInstant);
|
console.log("Transaction instant: " + txResult.txInstant);
|
||||||
|
|
||||||
// A simple query.
|
// A simple query.
|
||||||
let results = await db.q("[:find ?url :in $ :where [?e :page/url ?url]]");
|
let results = await db.q("[:find [?url ...] :in $ :where [?e :page/url ?url]]");
|
||||||
results = results.map(r => r[0]);
|
|
||||||
|
|
||||||
console.log("Query results: " + JSON.stringify(results));
|
console.log("Query results: " + JSON.stringify(results));
|
||||||
|
|
||||||
// Let's extend our schema. In the real world this would typically happen
|
// Let's extend our schema. In the real world this would typically happen
|
||||||
|
@ -63,12 +61,12 @@ async function testOpen() {
|
||||||
|
|
||||||
// When did we most recently visit this page?
|
// When did we most recently visit this page?
|
||||||
let date = (await db.q(
|
let date = (await db.q(
|
||||||
`[:find (max ?date)
|
`[:find (max ?date) .
|
||||||
:in $ ?url
|
:in $ ?url
|
||||||
:where
|
:where
|
||||||
[?page :page/url ?url]
|
[?page :page/url ?url]
|
||||||
[?page :page/visitedAt ?date]]`,
|
[?page :page/visitedAt ?date]]`,
|
||||||
{"inputs": {"url": "https://mozilla.org/"}}))[0][0];
|
{"inputs": {"url": "https://mozilla.org/"}}));
|
||||||
console.log("Most recent visit: " + date);
|
console.log("Most recent visit: " + date);
|
||||||
|
|
||||||
// Close: we're done!
|
// Close: we're done!
|
||||||
|
|
Loading…
Reference in a new issue