Skip to content

Commit

Permalink
get jest working with package exports
Browse files Browse the repository at this point in the history
see jestjs/jest#9771

using jest v28.0.0-alpha.3

"package exports" are how we export from `mono/model`
  • Loading branch information
tantaman committed Mar 15, 2022
1 parent 41ba39b commit 1476fae
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 8 deletions.
12 changes: 12 additions & 0 deletions typescript/packages/model.usage/babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
presets: [
[
"@babel/preset-env",
{
targets: {
node: "current",
},
},
],
],
};
12 changes: 9 additions & 3 deletions typescript/packages/model.usage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,22 @@
"type-graphql": "^1.1.1"
},
"devDependencies": {
"@babel/preset-env": "^7.16.11",
"@types/jest": "^27.4.1",
"command-line-args": "^5.2.1",
"command-line-usage": "^6.1.1",
"jest": "^27.5.1",
"jest": "^28.0.0-alpha.3",
"ts-jest": "^27.1.3",
"typescript": "^4.6.2"
},
"scripts": {
"build": "tsc",
"watch": "tsc -w"
"watch": "tsc -w",
"test": "node ./node_modules/jest/bin/jest.js"
},
"test": "node ./node_modules/jest/bin/jest.js"
"jest": {
"testMatch": [
"**/__tests__/**/*.test.js"
]
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
import sid from "@strut/sid";
import SlideQuery from "../SlideQuery.js";

// We'll try to load all slides and see how it goes!
test("Query from id", () => {
SlideQuery.fromId(sid("foo"));
});
8 changes: 4 additions & 4 deletions typescript/packages/model/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
TODO:
1. Put field edge ids into `Data`
2. Generate call `fromForiegnKey` (fromSlideId) in methods like `queryComponents` on `Slide`
3. Use ID types...
4. Validation step...
1. Validation step...
1. To ensure foreign key edges have an appropriate inverse field edge
1. on the other schema.
2. Generate MySQL Table Schemas
3. Generate queryAll methods
4. Enable model interfaces

Are the synthetic transactions not good enough / not doing it?

Expand Down
2 changes: 1 addition & 1 deletion typescript/packages/model/src/query/Query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export abstract class DerivedQuery<TOut> extends BaseQuery<TOut> {
#priorQuery: Query<TOut>;
#expression?: Expression;

constructor(priorQuery: Query<TOut>, expression?: Expression) {
constructor(priorQuery: Query<any>, expression?: Expression) {
super();
this.#priorQuery = priorQuery;
this.#expression = expression;
Expand Down

0 comments on commit 1476fae

Please sign in to comment.