Skip to content

Commit

Permalink
fix: add better embroider test and fix embroider compat (#8410)
Browse files Browse the repository at this point in the history
* Add embroider try scenarios

* Add maybeEmbroider for main app

* Remove comment

* fix newlines

* update compat scenario locations

* continue on error

* fix?

* remove embroider test-setup

* add test and fix

---------

Co-authored-by: Chris Thoburn <[email protected]>
  • Loading branch information
mkszepp and runspired authored Feb 25, 2023
1 parent 38c23e0 commit 6143956
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ module.exports = function (babel) {
binding.referencePaths.forEach((p) => {
p.replaceWith(
// t.callExpression(state.importer.import(p, '@embroider/macros', 'macroCondition'), [
t.callExpression(state.importer.import(p, '@embroider/macros', 'moduleExists'), [
t.callExpression(state.importer.import(p, '@embroider/macros', 'dependencySatisfies'), [
t.stringLiteral(replacements[name]),
t.stringLiteral('*'),
])
// ])
);
Expand Down
5 changes: 5 additions & 0 deletions tests/embroider-basic-compat/app/models/user.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Model, { attr } from '@ember-data/model';

export default class User extends Model {
@attr declare name: string;
}
9 changes: 9 additions & 0 deletions tests/embroider-basic-compat/tests/acceptance/visit-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,13 @@ module('it works', function (hooks) {
await visit('/');
assert.ok('it works!');
});

test('we can use the store', async function (assert) {
const { owner } = this;
const store = owner.lookup('service:store');

const record = store.createRecord('user', { name: 'Chris' });

assert.strictEqual(record.name, 'Chris', 'correct name');
});
});

0 comments on commit 6143956

Please sign in to comment.