Skip to content

Commit

Permalink
Add a test for the positive case for successful transformation of '@c…
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Feb 26, 2022
1 parent b831897 commit 1c9b310
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions tests/scenarios/glimmer-tracking-test.ts
@@ -0,0 +1,61 @@
import { appReleaseScenario } from './scenarios';
import { PreparedApp } from 'scenario-tester';
import QUnit from 'qunit';
import merge from 'lodash/merge';
const { module: Qmodule, test } = QUnit;

appReleaseScenario
.map('transform @glimmer/tracking', project => {
merge(project.files, {
app: {
components: {
'demo.js': `
import Component from '@glimmer/component';
import { cached } from '@glimmer/tracking';
export default class Demo extends Component {
@cached
get foo() {
return 'boop';
}
}
`,
'demo.hbs': `{{this.foo}}`,
},
},
tests: {
rendering: {
'demo-test.js': `
import { module, test } from 'qunit';
import { render } from '@ember/test-helpers';
import { setupRenderingTest } from 'ember-qunit';
import { hbs } from 'ember-cli-htmlbars';
module('<Demo>', function(hooks) {
setupRenderingTest(hooks);
test(\`doesn't error\`, async function(assert) {
await render(hbs\`<Demo />\`);
assert.dom().hasText('boop');
});
});
`,
},
},
});
})
.forEachScenario(scenario => {
Qmodule(scenario.name, function (hooks) {
let app: PreparedApp;
hooks.before(async () => {
app = await scenario.prepare();
});

test(`yarn test`, async function (assert) {
let result = await app.execute('yarn test');
assert.equal(result.exitCode, 0, result.output);
});
});
});

0 comments on commit 1c9b310

Please sign in to comment.