From 757944de4ec7c4be4add70542e168be063256a09 Mon Sep 17 00:00:00 2001 From: Chris Thoburn Date: Wed, 18 Oct 2023 00:00:15 -0700 Subject: [PATCH 1/3] chore(private): migrate adapter test package to diagnostic --- .eslintrc.js | 1 + packages/diagnostic/server/default-setup.js | 2 +- pnpm-lock.yaml | 21 +-- tests/ember-data__adapter/.ember-cli | 9 -- tests/ember-data__adapter/.gitignore | 25 ---- tests/ember-data__adapter/.template-lintrc.js | 5 - tests/ember-data__adapter/.watchmanconfig | 3 - .../app/components/.gitkeep | 0 .../app/controllers/.gitkeep | 0 .../ember-data__adapter/app/helpers/.gitkeep | 0 tests/ember-data__adapter/app/models/.gitkeep | 0 .../app/templates/components/.gitkeep | 0 tests/ember-data__adapter/diagnostic.js | 5 + tests/ember-data__adapter/ember-cli-build.js | 2 + tests/ember-data__adapter/package.json | 16 +- tests/ember-data__adapter/public/robots.txt | 3 - tests/ember-data__adapter/testem.js | 30 ---- .../tests/helpers/.gitkeep | 0 tests/ember-data__adapter/tests/index.html | 10 +- .../tests/integration/.gitkeep | 0 .../tests/integration/belongs-to-test.js | 70 ++++----- .../tests/integration/coalescing-test.js | 130 ++++++++--------- .../tests/integration/generate-id-test.js | 10 +- .../tests/integration/has-many-test.js | 118 +++++++-------- .../tests/integration/mutations-test.js | 82 +++++------ .../tests/integration/queries-test.js | 48 +++--- .../tests/integration/reload-test.js | 138 ++++++++---------- .../ember-data__adapter/tests/test-helper.js | 59 +++++++- tests/ember-data__adapter/tests/unit/.gitkeep | 0 tests/ember-data__adapter/vendor/.gitkeep | 0 30 files changed, 368 insertions(+), 419 deletions(-) delete mode 100644 tests/ember-data__adapter/.ember-cli delete mode 100644 tests/ember-data__adapter/.gitignore delete mode 100644 tests/ember-data__adapter/.template-lintrc.js delete mode 100644 tests/ember-data__adapter/.watchmanconfig delete mode 100644 tests/ember-data__adapter/app/components/.gitkeep delete mode 100644 tests/ember-data__adapter/app/controllers/.gitkeep delete mode 100644 tests/ember-data__adapter/app/helpers/.gitkeep delete mode 100644 tests/ember-data__adapter/app/models/.gitkeep delete mode 100644 tests/ember-data__adapter/app/templates/components/.gitkeep create mode 100644 tests/ember-data__adapter/diagnostic.js delete mode 100644 tests/ember-data__adapter/public/robots.txt delete mode 100644 tests/ember-data__adapter/testem.js delete mode 100644 tests/ember-data__adapter/tests/helpers/.gitkeep delete mode 100644 tests/ember-data__adapter/tests/integration/.gitkeep delete mode 100644 tests/ember-data__adapter/tests/unit/.gitkeep delete mode 100644 tests/ember-data__adapter/vendor/.gitkeep diff --git a/.eslintrc.js b/.eslintrc.js index 623b72cc9b9..ce27ac6f8cc 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -108,6 +108,7 @@ module.exports = { 'tests/ember-data__json-api/**', 'tests/ember-data__graph/**', 'tests/ember-data__request/**', + 'tests/ember-data__adapter/**', 'tests/builders/**', ], rules: { diff --git a/packages/diagnostic/server/default-setup.js b/packages/diagnostic/server/default-setup.js index 364d7ebd167..851fd3263c1 100644 --- a/packages/diagnostic/server/default-setup.js +++ b/packages/diagnostic/server/default-setup.js @@ -74,7 +74,7 @@ export default async function launchDefault(overrides = {}) { launchers: overrides.launchers ?? { [BROWSER_TAG]: { command: browser, - args: recommendedArgs(BROWSER_TAG), + args: recommendedArgs(BROWSER_TAG, overrides), }, } }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c4cf5f6feee..c305f1ca127 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1879,6 +1879,9 @@ importers: '@types/ember__owner': specifier: ^4.0.6 version: 4.0.6 + '@warp-drive/diagnostic': + specifier: workspace:5.5.0-alpha.11 + version: file:packages/diagnostic ember-auto-import: specifier: ^2.6.3 version: 2.6.3(webpack@5.89.0) @@ -1897,6 +1900,9 @@ importers: ember-cli-inject-live-reload: specifier: ^2.1.0 version: 2.1.0 + ember-cli-test-loader: + specifier: ^3.1.0 + version: 3.1.0(@babel/core@7.23.2) ember-inflector: specifier: ^4.0.2 version: 4.0.2(@babel/core@7.23.2) @@ -1906,9 +1912,6 @@ importers: ember-maybe-import-regenerator: specifier: ^1.0.0 version: 1.0.0(@babel/core@7.23.2) - ember-qunit: - specifier: ^8.0.1 - version: 8.0.1(@babel/core@7.23.2)(@ember/test-helpers@3.2.0)(ember-source@5.3.0)(qunit@2.19.4) ember-resolver: specifier: ^11.0.1 version: 11.0.1(@babel/core@7.23.2)(ember-source@5.3.0) @@ -1918,12 +1921,6 @@ importers: loader.js: specifier: ^4.7.0 version: 4.7.0 - qunit: - specifier: 2.19.4 - version: 2.19.4(patch_hash=h2fz5inojlzu6daraxt5bghsqy) - qunit-dom: - specifier: ^3.0.0 - version: 3.0.0 webpack: specifier: ^5.89.0 version: 5.89.0 @@ -1950,6 +1947,8 @@ importers: injected: true '@ember-data/unpublished-test-infra': injected: true + '@warp-drive/diagnostic': + injected: true tests/ember-data__graph: devDependencies: @@ -5134,6 +5133,7 @@ packages: semver: 7.5.4 transitivePeerDependencies: - supports-color + dev: true /@embroider/babel-loader-9@3.1.0(@embroider/core@3.3.0)(supports-color@8.1.1)(webpack@5.89.0): resolution: {integrity: sha512-TEOaOAsci15Zc3qh8kFAt/XpAsKjw/DzS/1+dv7yNGOeEgqImux+RoZ7DkZkVZNeuA0eAonpY79B+B0J17Us5g==} @@ -10380,6 +10380,7 @@ packages: - '@babel/core' - '@glint/template' - supports-color + dev: true /ember-raf-scheduler@0.3.0(@babel/core@7.23.2): resolution: {integrity: sha512-i8JWQidNCX7n5TOTIKRDR0bnsQN9aJh/GtOJKINz2Wr+I7L7sYVhli6MFqMYNGKC9j9e6iWsznfAIxddheyEow==} @@ -15024,6 +15025,7 @@ packages: /qunit-dom@3.0.0: resolution: {integrity: sha512-rqGZ9ZgOvtOY+Ph2ElCJ4pRIHouMZmI3DWK35Xr3x3c17/gIwOHHyKAQk6XetqhqepS6p+oXvK6Bx1uZu5jJuw==} + dev: true /qunit@2.19.4(patch_hash=h2fz5inojlzu6daraxt5bghsqy): resolution: {integrity: sha512-aqUzzUeCqlleWYKlpgfdHHw9C6KxkB9H3wNfiBg5yHqQMzy0xw/pbCRHYFkjl8MsP/t8qkTQE+JTYL71azgiew==} @@ -17606,7 +17608,6 @@ packages: tmp: 0.2.1 transitivePeerDependencies: - supports-color - dev: true file:packages/graph(@babel/core@7.23.2)(@ember-data/store@5.5.0-alpha.11): resolution: {directory: packages/graph, type: directory} diff --git a/tests/ember-data__adapter/.ember-cli b/tests/ember-data__adapter/.ember-cli deleted file mode 100644 index ee64cfed2a8..00000000000 --- a/tests/ember-data__adapter/.ember-cli +++ /dev/null @@ -1,9 +0,0 @@ -{ - /** - Ember CLI sends analytics information by default. The data is completely - anonymous, but there are times when you might want to disable this behavior. - - Setting `disableAnalytics` to true will prevent any data from being sent. - */ - "disableAnalytics": false -} diff --git a/tests/ember-data__adapter/.gitignore b/tests/ember-data__adapter/.gitignore deleted file mode 100644 index c40a1b2aba3..00000000000 --- a/tests/ember-data__adapter/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -# See https://help.github.com/ignore-files/ for more about ignoring files. - -# compiled output -/dist/ -/tmp/ - -# dependencies -/bower_components/ -/node_modules/ - -# misc -/.env* -/.pnp* -/.sass-cache -/connect.lock -/coverage/ -/libpeerconnection.log -/npm-debug.log* -/testem.log -/yarn-error.log - -# ember-try -/.node_modules.ember-try/ -/bower.json.ember-try -/package.json.ember-try diff --git a/tests/ember-data__adapter/.template-lintrc.js b/tests/ember-data__adapter/.template-lintrc.js deleted file mode 100644 index f35f61c7b3a..00000000000 --- a/tests/ember-data__adapter/.template-lintrc.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -module.exports = { - extends: 'recommended', -}; diff --git a/tests/ember-data__adapter/.watchmanconfig b/tests/ember-data__adapter/.watchmanconfig deleted file mode 100644 index e7834e3e4f3..00000000000 --- a/tests/ember-data__adapter/.watchmanconfig +++ /dev/null @@ -1,3 +0,0 @@ -{ - "ignore_dirs": ["tmp", "dist"] -} diff --git a/tests/ember-data__adapter/app/components/.gitkeep b/tests/ember-data__adapter/app/components/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/ember-data__adapter/app/controllers/.gitkeep b/tests/ember-data__adapter/app/controllers/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/ember-data__adapter/app/helpers/.gitkeep b/tests/ember-data__adapter/app/helpers/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/ember-data__adapter/app/models/.gitkeep b/tests/ember-data__adapter/app/models/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/ember-data__adapter/app/templates/components/.gitkeep b/tests/ember-data__adapter/app/templates/components/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/ember-data__adapter/diagnostic.js b/tests/ember-data__adapter/diagnostic.js new file mode 100644 index 00000000000..9084fb02e58 --- /dev/null +++ b/tests/ember-data__adapter/diagnostic.js @@ -0,0 +1,5 @@ +import launch from '@warp-drive/diagnostic/server/default-setup.js'; + +await launch({ + headless: false, +}); diff --git a/tests/ember-data__adapter/ember-cli-build.js b/tests/ember-data__adapter/ember-cli-build.js index 8f86cbd8ec6..6b70efd19b7 100644 --- a/tests/ember-data__adapter/ember-cli-build.js +++ b/tests/ember-data__adapter/ember-cli-build.js @@ -6,6 +6,7 @@ const EmberApp = require('ember-cli/lib/broccoli/ember-app'); module.exports = function (defaults) { let app = new EmberApp(defaults, { + tests: true, // Add options here }); @@ -21,6 +22,7 @@ module.exports = function (defaults) { // modules that you would like to import into your application // please specify an object with the list of modules as keys // along with the exports of each module as its value. + app.import('node_modules/@warp-drive/diagnostic/dist/styles/dom-reporter.css'); return app.toTree(); }; diff --git a/tests/ember-data__adapter/package.json b/tests/ember-data__adapter/package.json index f2377e23bc1..f48168b7acf 100644 --- a/tests/ember-data__adapter/package.json +++ b/tests/ember-data__adapter/package.json @@ -15,11 +15,9 @@ "test": "tests" }, "scripts": { - "build": "ember build", - "lint:hbs": "ember-template-lint .", - "lint:js": "eslint --config ../../.eslintrc.js --ignore-path ../../.eslintignore .", - "start": "ember serve", - "test": "ember test --test-port=0" + "build": "ember build --output-path=dist-test --suppress-sizes", + "test": "pnpm build && bun ./diagnostic.js", + "test:production": "pnpm build -e production; bun ./diagnostic.js" }, "dependenciesMeta": { "@ember-data/debug": { @@ -54,6 +52,9 @@ }, "@ember-data/unpublished-test-infra": { "injected": true + }, + "@warp-drive/diagnostic": { + "injected": true } }, "dependencies": { @@ -70,6 +71,7 @@ "@ember-data/store": "workspace:5.5.0-alpha.11", "@ember-data/tracking": "workspace:5.5.0-alpha.11", "@ember-data/unpublished-test-infra": "workspace:5.5.0-alpha.11", + "@warp-drive/diagnostic": "workspace:5.5.0-alpha.11", "@ember/optional-features": "^2.0.0", "@ember/string": "3.1.1", "@ember/test-helpers": "^3.2.0", @@ -82,15 +84,13 @@ "ember-cli-dependency-checker": "^3.3.2", "ember-cli-htmlbars": "^6.3.0", "ember-cli-inject-live-reload": "^2.1.0", + "ember-cli-test-loader": "^3.1.0", "ember-inflector": "^4.0.2", "ember-load-initializers": "^2.1.2", "ember-maybe-import-regenerator": "^1.0.0", - "ember-qunit": "^8.0.1", "ember-resolver": "^11.0.1", "ember-source": "~5.3.0", "loader.js": "^4.7.0", - "qunit": "^2.20.0", - "qunit-dom": "^3.0.0", "webpack": "^5.89.0" }, "engines": { diff --git a/tests/ember-data__adapter/public/robots.txt b/tests/ember-data__adapter/public/robots.txt deleted file mode 100644 index f5916452e5f..00000000000 --- a/tests/ember-data__adapter/public/robots.txt +++ /dev/null @@ -1,3 +0,0 @@ -# http://www.robotstxt.org -User-agent: * -Disallow: diff --git a/tests/ember-data__adapter/testem.js b/tests/ember-data__adapter/testem.js deleted file mode 100644 index e10b064501a..00000000000 --- a/tests/ember-data__adapter/testem.js +++ /dev/null @@ -1,30 +0,0 @@ -// eslint-disable-next-line node/no-unpublished-require -const customDotReporter = require('@ember-data/unpublished-test-infra/src/testem/custom-dot-reporter'); - -// eslint-disable-next-line no-console -console.log(`\n\nLaunching with ${process.env.TESTEM_CI_LAUNCHER || 'Chrome'}\n\n`); - -module.exports = { - test_page: 'tests/index.html?hidepassed&nocontainer', - disable_watching: true, - reporter: customDotReporter, - launch_in_ci: [process.env.TESTEM_CI_LAUNCHER || 'Chrome'], - launch_in_dev: ['Chrome'], - browser_start_timeout: 120, - browser_args: { - Chrome: { - ci: [ - '--headless', - '--disable-dev-shm-usage', - '--disable-software-rasterizer', - '--mute-audio', - '--remote-debugging-port=0', - '--window-size=1440,900', - '--no-sandbox', - ], - }, - }, - Firefox: { - ci: ['-headless', '-width 1440', '-height 900'], - }, -}; diff --git a/tests/ember-data__adapter/tests/helpers/.gitkeep b/tests/ember-data__adapter/tests/helpers/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/ember-data__adapter/tests/index.html b/tests/ember-data__adapter/tests/index.html index d2edd4eccbd..06fe27520dd 100644 --- a/tests/ember-data__adapter/tests/index.html +++ b/tests/ember-data__adapter/tests/index.html @@ -12,7 +12,6 @@ - {{content-for "head-footer"}} {{content-for "test-head-footer"}} @@ -21,14 +20,11 @@ {{content-for "body"}} {{content-for "test-body"}} -
-
-
-
-
+
+
+
- diff --git a/tests/ember-data__adapter/tests/integration/.gitkeep b/tests/ember-data__adapter/tests/integration/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/ember-data__adapter/tests/integration/belongs-to-test.js b/tests/ember-data__adapter/tests/integration/belongs-to-test.js index 81d9b15ac3b..7c6381443d1 100644 --- a/tests/ember-data__adapter/tests/integration/belongs-to-test.js +++ b/tests/ember-data__adapter/tests/integration/belongs-to-test.js @@ -1,12 +1,12 @@ import EmberObject from '@ember/object'; -import { module, test } from 'qunit'; +import { module, test } from '@warp-drive/diagnostic'; import Store from 'ember-data__adapter/services/store'; -import { setupTest } from 'ember-qunit'; import Model, { attr, belongsTo, hasMany } from '@ember-data/model'; import deepCopy from '@ember-data/unpublished-test-infra/test-support/deep-copy'; +import { setupTest } from '@ember-data/unpublished-test-infra/test-support/test-helpers'; import testInDebug from '@ember-data/unpublished-test-infra/test-support/test-in-debug'; class MinimalSerializer extends EmberObject { @@ -155,14 +155,14 @@ module('integration/belongs-to - Belongs To Tests', function (hooks) { findBelongsTo(passedStore, snapshot, url, relationship) { findBelongsToCalled++; - assert.strictEqual(passedStore, store, 'instance of store is passed to findBelongsTo'); + assert.equal(passedStore, store, 'instance of store is passed to findBelongsTo'); let expectedURL = initialRecord.data.relationships.post.links.related; - assert.strictEqual(url, expectedURL, 'url is passed to findBelongsTo'); - assert.strictEqual(relationship.key, 'post', 'relationship is passed to findBelongsTo'); + assert.equal(url, expectedURL, 'url is passed to findBelongsTo'); + assert.equal(relationship.key, 'post', 'relationship is passed to findBelongsTo'); - assert.strictEqual(snapshot.modelName, 'comment', 'snapshot is passed to findBelongsTo with correct modelName'); - assert.strictEqual(snapshot.id, '3', 'snapshot is passed to findBelongsTo with correct id'); + assert.equal(snapshot.modelName, 'comment', 'snapshot is passed to findBelongsTo with correct modelName'); + assert.equal(snapshot.id, '3', 'snapshot is passed to findBelongsTo with correct id'); return Promise.resolve(expectedResultCopy); } @@ -174,8 +174,8 @@ module('integration/belongs-to - Belongs To Tests', function (hooks) { let post = await comment.post; - assert.strictEqual(findRecordCalled, 0, 'findRecord is not called'); - assert.strictEqual(findBelongsToCalled, 1, 'findBelongsTo is called once'); + assert.equal(findRecordCalled, 0, 'findRecord is not called'); + assert.equal(findBelongsToCalled, 1, 'findBelongsTo is called once'); assert.deepEqual(post.serialize(), expectedResult, 'findBelongsTo returns expected result'); }); @@ -268,12 +268,12 @@ module('integration/belongs-to - Belongs To Tests', function (hooks) { findRecord(passedStore, type, id, snapshot) { findRecordCalled++; - assert.strictEqual(passedStore, store, 'instance of store is passed to findRecord'); - assert.strictEqual(type, Post, 'model is passed to findRecord'); - assert.strictEqual(id, '2', 'id is passed to findRecord'); + assert.equal(passedStore, store, 'instance of store is passed to findRecord'); + assert.equal(type, Post, 'model is passed to findRecord'); + assert.equal(id, '2', 'id is passed to findRecord'); - assert.strictEqual(snapshot.modelName, 'post', 'snapshot is passed to findRecord with correct modelName'); - assert.strictEqual(snapshot.id, '2', 'snapshot is passed to findRecord with correct id'); + assert.equal(snapshot.modelName, 'post', 'snapshot is passed to findRecord with correct modelName'); + assert.equal(snapshot.id, '2', 'snapshot is passed to findRecord with correct id'); return Promise.resolve(expectedResultCopy); } @@ -289,8 +289,8 @@ module('integration/belongs-to - Belongs To Tests', function (hooks) { let post = await comment.post; - assert.strictEqual(findRecordCalled, 1, 'findRecord is called once'); - assert.strictEqual(findBelongsToCalled, 0, 'findBelongsTo is not called'); + assert.equal(findRecordCalled, 1, 'findRecord is called once'); + assert.equal(findBelongsToCalled, 0, 'findBelongsTo is not called'); assert.deepEqual(post.serialize(), expectedResult, 'findRecord returns expected result'); }); @@ -347,12 +347,12 @@ module('integration/belongs-to - Belongs To Tests', function (hooks) { findRecord(passedStore, type, id, snapshot) { findRecordCalled++; - assert.strictEqual(passedStore, store, 'instance of store is passed to findRecord'); - assert.strictEqual(type, Post, 'model is passed to findRecord'); - assert.strictEqual(id, '2', 'id is passed to findRecord'); + assert.equal(passedStore, store, 'instance of store is passed to findRecord'); + assert.equal(type, Post, 'model is passed to findRecord'); + assert.equal(id, '2', 'id is passed to findRecord'); - assert.strictEqual(snapshot.modelName, 'post', 'snapshot is passed to findRecord with correct modelName'); - assert.strictEqual(snapshot.id, '2', 'snapshot is passed to findRecord with correct id'); + assert.equal(snapshot.modelName, 'post', 'snapshot is passed to findRecord with correct modelName'); + assert.equal(snapshot.id, '2', 'snapshot is passed to findRecord with correct id'); return Promise.resolve(expectedResultCopy); } @@ -364,7 +364,7 @@ module('integration/belongs-to - Belongs To Tests', function (hooks) { let post = await comment.post; - assert.strictEqual(findRecordCalled, 1, 'findRecord is called once'); + assert.equal(findRecordCalled, 1, 'findRecord is called once'); assert.deepEqual(post.serialize(), expectedResult, 'findRecord returns expected result'); }); @@ -429,14 +429,14 @@ module('integration/belongs-to - Belongs To Tests', function (hooks) { findBelongsTo(passedStore, snapshot, url, relationship) { findBelongsToCalled++; - assert.strictEqual(passedStore, store, 'instance of store is passed to findBelongsTo'); + assert.equal(passedStore, store, 'instance of store is passed to findBelongsTo'); let expectedURL = initialRecord.data.relationships.post.links.related; - assert.strictEqual(url, expectedURL, 'url is passed to findBelongsTo'); - assert.strictEqual(relationship.name, 'post', 'relationship is passed to findBelongsTo'); + assert.equal(url, expectedURL, 'url is passed to findBelongsTo'); + assert.equal(relationship.name, 'post', 'relationship is passed to findBelongsTo'); - assert.strictEqual(snapshot.modelName, 'comment', 'snapshot is passed to findBelongsTo with correct modelName'); - assert.strictEqual(snapshot.id, '3', 'snapshot is passed to findBelongsTo with correct id'); + assert.equal(snapshot.modelName, 'comment', 'snapshot is passed to findBelongsTo with correct modelName'); + assert.equal(snapshot.id, '3', 'snapshot is passed to findBelongsTo with correct id'); return Promise.resolve(expectedResultCopy); } @@ -448,8 +448,8 @@ module('integration/belongs-to - Belongs To Tests', function (hooks) { let post = await comment.post; - assert.strictEqual(findRecordCalled, 0, 'findRecord is not called'); - assert.strictEqual(findBelongsToCalled, 1, 'findBelongsTo is called once'); + assert.equal(findRecordCalled, 0, 'findRecord is not called'); + assert.equal(findBelongsToCalled, 1, 'findBelongsTo is called once'); assert.deepEqual(post.serialize(), expectedResult, 'findBelongsTo returns expected result'); }); @@ -506,12 +506,12 @@ module('integration/belongs-to - Belongs To Tests', function (hooks) { findRecord(passedStore, type, id, snapshot) { findRecordCalled++; - assert.strictEqual(passedStore, store, 'instance of store is passed to findRecord'); - assert.strictEqual(type, Post, 'model is passed to findRecord'); - assert.strictEqual(id, '2', 'id is passed to findRecord'); + assert.equal(passedStore, store, 'instance of store is passed to findRecord'); + assert.equal(type, Post, 'model is passed to findRecord'); + assert.equal(id, '2', 'id is passed to findRecord'); - assert.strictEqual(snapshot.modelName, 'post', 'snapshot is passed to findRecord with correct modelName'); - assert.strictEqual(snapshot.id, '2', 'snapshot is passed to findRecord with correct id'); + assert.equal(snapshot.modelName, 'post', 'snapshot is passed to findRecord with correct modelName'); + assert.equal(snapshot.id, '2', 'snapshot is passed to findRecord with correct id'); return Promise.resolve(expectedResultCopy); } @@ -523,7 +523,7 @@ module('integration/belongs-to - Belongs To Tests', function (hooks) { let post = await comment.post; - assert.strictEqual(findRecordCalled, 1, 'findRecord is called once'); + assert.equal(findRecordCalled, 1, 'findRecord is called once'); assert.deepEqual(post.serialize(), expectedResult, 'findRecord returns expected result'); }); }); diff --git a/tests/ember-data__adapter/tests/integration/coalescing-test.js b/tests/ember-data__adapter/tests/integration/coalescing-test.js index 35250b724ea..4e74ec00026 100644 --- a/tests/ember-data__adapter/tests/integration/coalescing-test.js +++ b/tests/ember-data__adapter/tests/integration/coalescing-test.js @@ -1,13 +1,13 @@ import EmberObject from '@ember/object'; -import { module, test } from 'qunit'; +import { module, test } from '@warp-drive/diagnostic'; import Store from 'ember-data__adapter/services/store'; -import { setupTest } from 'ember-qunit'; import Model, { attr } from '@ember-data/model'; import { recordIdentifierFor } from '@ember-data/store'; import deepCopy from '@ember-data/unpublished-test-infra/test-support/deep-copy'; +import { setupTest } from '@ember-data/unpublished-test-infra/test-support/test-helpers'; class MinimalSerializer extends EmberObject { normalizeResponse(_, __, data) { @@ -80,14 +80,14 @@ module('integration/coalescing - Coalescing Tests', function (hooks) { coalesceFindRequests = true; findRecord(passedStore, type, id, snapshot) { - assert.strictEqual(passedStore, store, 'instance of store is passed to findRecord'); - assert.strictEqual(type, Person, 'model is passed to findRecord'); + assert.equal(passedStore, store, 'instance of store is passed to findRecord'); + assert.equal(type, Person, 'model is passed to findRecord'); let expectedId = expectedResultsCopy[findRecordCalled].data.id; - assert.strictEqual(id, expectedId, 'id is passed to findRecord'); + assert.equal(id, expectedId, 'id is passed to findRecord'); - assert.strictEqual(snapshot.modelName, 'person', 'snapshot is passed to findRecord with correct modelName'); - assert.strictEqual(snapshot.id, expectedId, 'snapshot is passed to findRecord with correct id'); + assert.equal(snapshot.modelName, 'person', 'snapshot is passed to findRecord with correct modelName'); + assert.equal(snapshot.id, expectedId, 'snapshot is passed to findRecord with correct id'); return Promise.resolve(expectedResultsCopy[findRecordCalled++]); } @@ -100,7 +100,7 @@ module('integration/coalescing - Coalescing Tests', function (hooks) { let serializedRecords = records.map((record) => record.serialize()); - assert.strictEqual(findRecordCalled, 2, 'findRecord is called twice'); + assert.equal(findRecordCalled, 2, 'findRecord is called twice'); assert.deepEqual(serializedRecords, expectedResults, 'each findRecord returns expected result'); }); @@ -148,15 +148,15 @@ module('integration/coalescing - Coalescing Tests', function (hooks) { findMany(passedStore, type, ids, snapshots) { findManyCalled++; - assert.strictEqual(passedStore, store, 'instance of store is passed to findMany'); - assert.strictEqual(type, Person, 'model is passed to findMany'); + assert.equal(passedStore, store, 'instance of store is passed to findMany'); + assert.equal(type, Person, 'model is passed to findMany'); let expectedIds = expectedResultsCopy.data.map((record) => record.id); assert.deepEqual(ids, expectedIds, 'ids are passed to findMany'); snapshots.forEach((snapshot, index) => { - assert.strictEqual(snapshot.modelName, 'person', 'snapshot is passed to findMany with correct modelName'); - assert.strictEqual(snapshot.id, expectedIds[index], 'snapshot is passed to findMany with correct id'); + assert.equal(snapshot.modelName, 'person', 'snapshot is passed to findMany with correct modelName'); + assert.equal(snapshot.id, expectedIds[index], 'snapshot is passed to findMany with correct id'); }); return Promise.resolve(expectedResultsCopy); @@ -176,9 +176,9 @@ module('integration/coalescing - Coalescing Tests', function (hooks) { let serializedRecords = records.slice().map((record) => record.serialize()); expectedResults = expectedResults.data.map((result) => ({ data: result })); - assert.strictEqual(findRecordCalled, 0, 'findRecord is not called'); - assert.strictEqual(findManyCalled, 1, 'findMany is called once'); - assert.strictEqual(groupRecordsForFindManyCalled, 1, 'groupRecordsForFindMany is called once'); + assert.equal(findRecordCalled, 0, 'findRecord is not called'); + assert.equal(findManyCalled, 1, 'findMany is called once'); + assert.equal(groupRecordsForFindManyCalled, 1, 'groupRecordsForFindMany is called once'); assert.deepEqual(serializedRecords, expectedResults, 'each findRecord returns expected result'); }); @@ -266,13 +266,13 @@ module('integration/coalescing - Coalescing Tests', function (hooks) { person2, ]; - assert.strictEqual(findRecordCalled, 8, 'findRecord is called 8x'); + assert.equal(findRecordCalled, 8, 'findRecord is called 8x'); assert.deepEqual(foundIdentifiers, expectedIdentifiers, 'each findRecord returns expected result'); const person1record = store.peekRecord('person', '1'); const person2record = store.peekRecord('person', '2'); - assert.strictEqual(person1record.firstName, 'Gaurav', 'person 1 loaded'); - assert.strictEqual(person2record.firstName, 'Chris', 'person 2 loaded'); + assert.equal(person1record.firstName, 'Gaurav', 'person 1 loaded'); + assert.equal(person2record.firstName, 'Chris', 'person 2 loaded'); }); test('Coalescing works with multiple includes options specified (uses findMany)', async function (assert) { @@ -332,8 +332,8 @@ module('integration/coalescing - Coalescing Tests', function (hooks) { findMany(passedStore, type, ids, snapshots) { findManyCalled++; - assert.strictEqual(passedStore, store, 'instance of store is passed to findMany'); - assert.strictEqual(type, Person, 'model is passed to findMany'); + assert.equal(passedStore, store, 'instance of store is passed to findMany'); + assert.equal(type, Person, 'model is passed to findMany'); let expectedIds = ['1', '2', '3', '4']; let expectedIncludes = [undefined, 'users', 'users.foo', ['comments']]; @@ -345,8 +345,8 @@ module('integration/coalescing - Coalescing Tests', function (hooks) { assert.deepEqual(options, expectedOptions, 'options are what was expected'); snapshots.forEach((snapshot, index) => { - assert.strictEqual(snapshot.modelName, 'person', 'snapshot is passed to findMany with correct modelName'); - assert.strictEqual(snapshot.id, expectedIds[index], 'snapshot is passed to findMany with correct id'); + assert.equal(snapshot.modelName, 'person', 'snapshot is passed to findMany with correct modelName'); + assert.equal(snapshot.id, expectedIds[index], 'snapshot is passed to findMany with correct id'); }); return Promise.resolve(expectedResults); @@ -375,19 +375,19 @@ module('integration/coalescing - Coalescing Tests', function (hooks) { let expectedIdentifiers = [person1, person2, person3, person4]; expectedResults = expectedResults.data.map((result) => ({ data: result })); - assert.strictEqual(findRecordCalled, 0, 'findRecord is not called'); - assert.strictEqual(findManyCalled, 1, 'findMany is called once'); - assert.strictEqual(groupRecordsForFindManyCalled, 1, 'groupRecordsForFindMany is called once'); + assert.equal(findRecordCalled, 0, 'findRecord is not called'); + assert.equal(findManyCalled, 1, 'findMany is called once'); + assert.equal(groupRecordsForFindManyCalled, 1, 'groupRecordsForFindMany is called once'); assert.deepEqual(foundIdentifiers, expectedIdentifiers, 'each findRecord returns expected result'); const person1record = store.peekRecord('person', '1'); const person2record = store.peekRecord('person', '2'); const person3record = store.peekRecord('person', '3'); const person4record = store.peekRecord('person', '4'); - assert.strictEqual(person1record.firstName, 'Gaurav', 'person 1 loaded'); - assert.strictEqual(person2record.firstName, 'Wesley', 'person 2 loaded'); - assert.strictEqual(person3record.firstName, 'James', 'person 3 loaded'); - assert.strictEqual(person4record.firstName, 'Chris', 'person 4 loaded'); + assert.equal(person1record.firstName, 'Gaurav', 'person 1 loaded'); + assert.equal(person2record.firstName, 'Wesley', 'person 2 loaded'); + assert.equal(person3record.firstName, 'James', 'person 3 loaded'); + assert.equal(person4record.firstName, 'Chris', 'person 4 loaded'); }); test('coalesceFindRequests is true and findMany is defined but groupRecordsForFindMany is undefined', async function (assert) { @@ -429,15 +429,15 @@ module('integration/coalescing - Coalescing Tests', function (hooks) { findMany(passedStore, type, ids, snapshots) { findManyCalled++; - assert.strictEqual(passedStore, store, 'instance of store is passed to findMany'); - assert.strictEqual(type, Person, 'model is passed to findMany'); + assert.equal(passedStore, store, 'instance of store is passed to findMany'); + assert.equal(type, Person, 'model is passed to findMany'); let expectedIds = expectedResultsCopy.data.map((record) => record.id); assert.deepEqual(ids, expectedIds, 'ids are passed to findMany'); snapshots.forEach((snapshot, index) => { - assert.strictEqual(snapshot.modelName, 'person', 'snapshot is passed to findMany with correct modelName'); - assert.strictEqual(snapshot.id, expectedIds[index], 'snapshot is passed to findMany with correct id'); + assert.equal(snapshot.modelName, 'person', 'snapshot is passed to findMany with correct modelName'); + assert.equal(snapshot.id, expectedIds[index], 'snapshot is passed to findMany with correct id'); }); return Promise.resolve(expectedResultsCopy); @@ -452,8 +452,8 @@ module('integration/coalescing - Coalescing Tests', function (hooks) { let serializedRecords = records.slice().map((record) => record.serialize()); expectedResults = expectedResults.data.map((result) => ({ data: result })); - assert.strictEqual(findRecordCalled, 0, 'findRecord is not called'); - assert.strictEqual(findManyCalled, 1, 'findMany is called once'); + assert.equal(findRecordCalled, 0, 'findRecord is not called'); + assert.equal(findManyCalled, 1, 'findMany is called once'); assert.deepEqual(serializedRecords, expectedResults, 'each findRecord returns expected result'); }); @@ -497,14 +497,14 @@ module('integration/coalescing - Coalescing Tests', function (hooks) { coalesceFindRequests = false; findRecord(passedStore, type, id, snapshot) { - assert.strictEqual(passedStore, store, 'instance of store is passed to findRecord'); - assert.strictEqual(type, Person, 'model is passed to findRecord'); + assert.equal(passedStore, store, 'instance of store is passed to findRecord'); + assert.equal(type, Person, 'model is passed to findRecord'); let expectedId = expectedResultsCopy[findRecordCalled].data.id; - assert.strictEqual(id, expectedId, 'id is passed to findRecord'); + assert.equal(id, expectedId, 'id is passed to findRecord'); - assert.strictEqual(snapshot.modelName, 'person', 'snapshot is passed to findRecord with correct modelName'); - assert.strictEqual(snapshot.id, expectedId, 'snapshot is passed to findRecord with correct id'); + assert.equal(snapshot.modelName, 'person', 'snapshot is passed to findRecord with correct modelName'); + assert.equal(snapshot.id, expectedId, 'snapshot is passed to findRecord with correct id'); return Promise.resolve(expectedResultsCopy[findRecordCalled++]); } @@ -526,9 +526,9 @@ module('integration/coalescing - Coalescing Tests', function (hooks) { let serializedRecords = records.map((record) => record.serialize()); - assert.strictEqual(findRecordCalled, 2, 'findRecord is called twice'); - assert.strictEqual(findManyCalled, 0, 'findMany is not called'); - assert.strictEqual(groupRecordsForFindManyCalled, 0, 'groupRecordsForFindMany is not called'); + assert.equal(findRecordCalled, 2, 'findRecord is called twice'); + assert.equal(findManyCalled, 0, 'findMany is not called'); + assert.equal(groupRecordsForFindManyCalled, 0, 'groupRecordsForFindMany is not called'); assert.deepEqual(serializedRecords, expectedResults, 'each findRecord returns expected result'); }); @@ -556,14 +556,14 @@ module('integration/coalescing - Coalescing Tests', function (hooks) { findRecordCalled++; if (findRecordCalled === 1) { - assert.strictEqual(snapshot.include, undefined, 'No include for first request'); - assert.strictEqual(snapshot.adapterOptions, undefined, 'No adapterOptions for first request'); + assert.equal(snapshot.include, undefined, 'No include for first request'); + assert.equal(snapshot.adapterOptions, undefined, 'No adapterOptions for first request'); } else if (findRecordCalled === 2) { - assert.strictEqual(snapshot.include, 'comments,friends', 'include is correct for second request'); - assert.strictEqual(snapshot.adapterOptions, undefined, 'No adapterOptions for second request'); + assert.equal(snapshot.include, 'comments,friends', 'include is correct for second request'); + assert.equal(snapshot.adapterOptions, undefined, 'No adapterOptions for second request'); } else if (findRecordCalled === 3) { - assert.strictEqual(snapshot.include, 'notFriends,comments', 'include is correct for third request'); - assert.strictEqual(snapshot.adapterOptions, undefined, 'No adapterOptions for third request'); + assert.equal(snapshot.include, 'notFriends,comments', 'include is correct for third request'); + assert.equal(snapshot.adapterOptions, undefined, 'No adapterOptions for third request'); } return { @@ -601,9 +601,9 @@ module('integration/coalescing - Coalescing Tests', function (hooks) { await Promise.all([request, request2, request3, request4, request5, request6, request7, request8, request9]); - assert.strictEqual(store.peekAll('person').length, 1, 'only one record is in the store'); + assert.equal(store.peekAll('person').length, 1, 'only one record is in the store'); - assert.strictEqual(findRecordCalled, 3, 'findRecord is called three times'); + assert.equal(findRecordCalled, 3, 'findRecord is called three times'); }); test('Coalescing accounts for multiple findRecord calls with different options by de-duping and using findRecord (order scenario 2)', async function (assert) { @@ -630,14 +630,14 @@ module('integration/coalescing - Coalescing Tests', function (hooks) { findRecordCalled++; if (findRecordCalled === 1) { - assert.strictEqual(snapshot.include, 'comments', 'include for first request'); - assert.strictEqual(snapshot.adapterOptions, undefined, 'No adapterOptions for first request'); + assert.equal(snapshot.include, 'comments', 'include for first request'); + assert.equal(snapshot.adapterOptions, undefined, 'No adapterOptions for first request'); } else if (findRecordCalled === 2) { - assert.strictEqual(snapshot.include, 'comments,friends', 'include is correct for second request'); - assert.strictEqual(snapshot.adapterOptions, undefined, 'No adapterOptions for second request'); + assert.equal(snapshot.include, 'comments,friends', 'include is correct for second request'); + assert.equal(snapshot.adapterOptions, undefined, 'No adapterOptions for second request'); } else if (findRecordCalled === 3) { - assert.strictEqual(snapshot.include, 'notFriends,comments', 'include is correct for third request'); - assert.strictEqual(snapshot.adapterOptions, undefined, 'No adapterOptions for third request'); + assert.equal(snapshot.include, 'notFriends,comments', 'include is correct for third request'); + assert.equal(snapshot.adapterOptions, undefined, 'No adapterOptions for third request'); } return { @@ -675,9 +675,9 @@ module('integration/coalescing - Coalescing Tests', function (hooks) { await Promise.all([request, request2, request3, request4, request5, request6, request7, request8, request9]); - assert.strictEqual(store.peekAll('person').length, 1, 'only one record is in the store'); + assert.equal(store.peekAll('person').length, 1, 'only one record is in the store'); - assert.strictEqual(findRecordCalled, 3, 'findRecord is called three times'); + assert.equal(findRecordCalled, 3, 'findRecord is called three times'); }); test('Coalescing accounts for multiple findRecord calls with different options by de-duping and using findRecord (order scenario 3)', async function (assert) { @@ -704,11 +704,11 @@ module('integration/coalescing - Coalescing Tests', function (hooks) { findRecordCalled++; if (findRecordCalled === 1) { - assert.strictEqual(snapshot.include, 'comments,friends', 'include is correct for second request'); - assert.strictEqual(snapshot.adapterOptions, undefined, 'No adapterOptions for second request'); + assert.equal(snapshot.include, 'comments,friends', 'include is correct for second request'); + assert.equal(snapshot.adapterOptions, undefined, 'No adapterOptions for second request'); } else if (findRecordCalled === 2) { - assert.strictEqual(snapshot.include, 'notFriends,comments', 'include is correct for third request'); - assert.strictEqual(snapshot.adapterOptions, undefined, 'No adapterOptions for third request'); + assert.equal(snapshot.include, 'notFriends,comments', 'include is correct for third request'); + assert.equal(snapshot.adapterOptions, undefined, 'No adapterOptions for third request'); } return { @@ -746,8 +746,8 @@ module('integration/coalescing - Coalescing Tests', function (hooks) { await Promise.all([request, request2, request3, request4, request5, request6, request7, request8, request9]); - assert.strictEqual(store.peekAll('person').length, 1, 'only one record is in the store'); + assert.equal(store.peekAll('person').length, 1, 'only one record is in the store'); - assert.strictEqual(findRecordCalled, 2, 'findRecord is called twice'); + assert.equal(findRecordCalled, 2, 'findRecord is called twice'); }); }); diff --git a/tests/ember-data__adapter/tests/integration/generate-id-test.js b/tests/ember-data__adapter/tests/integration/generate-id-test.js index ba5e7e24713..b7455f86fba 100644 --- a/tests/ember-data__adapter/tests/integration/generate-id-test.js +++ b/tests/ember-data__adapter/tests/integration/generate-id-test.js @@ -1,11 +1,11 @@ import EmberObject from '@ember/object'; -import { module, test } from 'qunit'; +import { module, test } from '@warp-drive/diagnostic'; import Store from 'ember-data__adapter/services/store'; -import { setupTest } from 'ember-qunit'; import Model, { attr } from '@ember-data/model'; +import { setupTest } from '@ember-data/unpublished-test-infra/test-support/test-helpers'; class MinimalSerializer extends EmberObject { normalizeResponse(_, __, data) { @@ -62,12 +62,12 @@ module('integration/generate-id - GenerateIdForRecord Tests', function (hooks) { let record = store.createRecord('person', expectedProps); - assert.strictEqual(record.id, 'manually generated id 1', 'manually generated id used'); + assert.equal(record.id, 'manually generated id 1', 'manually generated id used'); let recordFromPeekRecord = store.peekRecord('person', record.id); - assert.strictEqual(record, recordFromPeekRecord, 'peekRecord returns the same record'); - assert.strictEqual(generateIdForRecordCalled, 1, 'generateIdForRecord is called once'); + assert.equal(record, recordFromPeekRecord, 'peekRecord returns the same record'); + assert.equal(generateIdForRecordCalled, 1, 'generateIdForRecord is called once'); assert.deepEqual(record.serialize(), { data: { id: 'manually generated id 1', diff --git a/tests/ember-data__adapter/tests/integration/has-many-test.js b/tests/ember-data__adapter/tests/integration/has-many-test.js index 78cd62e2422..97488728995 100644 --- a/tests/ember-data__adapter/tests/integration/has-many-test.js +++ b/tests/ember-data__adapter/tests/integration/has-many-test.js @@ -1,12 +1,12 @@ import EmberObject from '@ember/object'; -import { module, test } from 'qunit'; +import { module, test } from '@warp-drive/diagnostic'; import Store from 'ember-data__adapter/services/store'; -import { setupTest } from 'ember-qunit'; import Model, { attr, belongsTo, hasMany } from '@ember-data/model'; import deepCopy from '@ember-data/unpublished-test-infra/test-support/deep-copy'; +import { setupTest } from '@ember-data/unpublished-test-infra/test-support/test-helpers'; import testInDebug from '@ember-data/unpublished-test-infra/test-support/test-in-debug'; class MinimalSerializer extends EmberObject { @@ -175,14 +175,14 @@ module('integration/has-many - Has Many Tests', function (hooks) { findHasMany(passedStore, snapshot, url, relationship) { findHasManyCalled++; - assert.strictEqual(passedStore, store, 'instance of store is passed to findHasMany'); + assert.equal(passedStore, store, 'instance of store is passed to findHasMany'); let expectedURL = initialRecord.data.relationships.comments.links.related; - assert.strictEqual(url, expectedURL, 'url is passed to findHasMany'); - assert.strictEqual(relationship.name, 'comments', 'relationship is passed to findHasMany'); + assert.equal(url, expectedURL, 'url is passed to findHasMany'); + assert.equal(relationship.name, 'comments', 'relationship is passed to findHasMany'); - assert.strictEqual(snapshot.modelName, 'post', 'snapshot is passed to findHasMany with correct modelName'); - assert.strictEqual(snapshot.id, '2', 'snapshot is passed to findHasMany with correct id'); + assert.equal(snapshot.modelName, 'post', 'snapshot is passed to findHasMany with correct modelName'); + assert.equal(snapshot.id, '2', 'snapshot is passed to findHasMany with correct id'); return Promise.resolve(expectedResultCopy); } @@ -197,9 +197,9 @@ module('integration/has-many - Has Many Tests', function (hooks) { data: comments.slice().map((comment) => comment.serialize().data), }; - assert.strictEqual(findRecordCalled, 0, 'findRecord is not called'); - assert.strictEqual(findManyCalled, 0, 'findMany is not called'); - assert.strictEqual(findHasManyCalled, 1, 'findHasMany is called once'); + assert.equal(findRecordCalled, 0, 'findRecord is not called'); + assert.equal(findManyCalled, 0, 'findMany is not called'); + assert.equal(findHasManyCalled, 1, 'findHasMany is called once'); assert.deepEqual(serializedComments, expectedResult, 'findHasMany returns expected result'); }); @@ -279,12 +279,12 @@ module('integration/has-many - Has Many Tests', function (hooks) { let index = findRecordCalled++; let expectedId = initialRecord.data.relationships.comments.data[index].id; - assert.strictEqual(passedStore, store, 'instance of store is passed to findRecord'); - assert.strictEqual(type, Comment, 'model is passed to findRecord'); - assert.strictEqual(id, expectedId, 'id is passed to findRecord'); + assert.equal(passedStore, store, 'instance of store is passed to findRecord'); + assert.equal(type, Comment, 'model is passed to findRecord'); + assert.equal(id, expectedId, 'id is passed to findRecord'); - assert.strictEqual(snapshot.modelName, 'comment', 'snapshot is passed to findRecord with correct modelName'); - assert.strictEqual(snapshot.id, expectedId, 'snapshot is passed to findRecord with correct id'); + assert.equal(snapshot.modelName, 'comment', 'snapshot is passed to findRecord with correct modelName'); + assert.equal(snapshot.id, expectedId, 'snapshot is passed to findRecord with correct id'); return Promise.resolve({ data: expectedResultCopy.data[index] }); } @@ -306,9 +306,9 @@ module('integration/has-many - Has Many Tests', function (hooks) { data: comments.slice().map((comment) => comment.serialize().data), }; - assert.strictEqual(findRecordCalled, 2, 'findRecord is called twice'); - assert.strictEqual(findManyCalled, 0, 'findMany is not called'); - assert.strictEqual(findHasManyCalled, 0, 'findHasMany is not called'); + assert.equal(findRecordCalled, 2, 'findRecord is called twice'); + assert.equal(findManyCalled, 0, 'findMany is not called'); + assert.equal(findHasManyCalled, 0, 'findHasMany is not called'); assert.deepEqual(serializedComments, expectedResult, 'get returns expected result'); }); @@ -355,12 +355,12 @@ module('integration/has-many - Has Many Tests', function (hooks) { let index = findRecordCalled++; let expectedId = initialRecord.data.relationships.comments.data[index].id; - assert.strictEqual(passedStore, store, 'instance of store is passed to findRecord'); - assert.strictEqual(type, Comment, 'model is passed to findRecord'); - assert.strictEqual(id, expectedId, 'id is passed to findRecord'); + assert.equal(passedStore, store, 'instance of store is passed to findRecord'); + assert.equal(type, Comment, 'model is passed to findRecord'); + assert.equal(id, expectedId, 'id is passed to findRecord'); - assert.strictEqual(snapshot.modelName, 'comment', 'snapshot is passed to findRecord with correct modelName'); - assert.strictEqual(snapshot.id, expectedId, 'snapshot is passed to findRecord with correct id'); + assert.equal(snapshot.modelName, 'comment', 'snapshot is passed to findRecord with correct modelName'); + assert.equal(snapshot.id, expectedId, 'snapshot is passed to findRecord with correct id'); return Promise.resolve({ data: expectedResultCopy.data[index] }); } @@ -378,8 +378,8 @@ module('integration/has-many - Has Many Tests', function (hooks) { data: comments.slice().map((comment) => comment.serialize().data), }; - assert.strictEqual(findRecordCalled, 2, 'findRecord is called twice'); - assert.strictEqual(findManyCalled, 0, 'findMany is not called'); + assert.equal(findRecordCalled, 2, 'findRecord is called twice'); + assert.equal(findManyCalled, 0, 'findMany is not called'); assert.deepEqual(serializedComments, expectedResult, 'get returns expected result'); }); @@ -438,15 +438,15 @@ module('integration/has-many - Has Many Tests', function (hooks) { findMany(passedStore, type, ids, snapshots) { findManyCalled++; - assert.strictEqual(passedStore, store, 'instance of store is passed to findMany'); - assert.strictEqual(type, Comment, 'model is passed to findMany'); + assert.equal(passedStore, store, 'instance of store is passed to findMany'); + assert.equal(type, Comment, 'model is passed to findMany'); let expectedIds = expectedResultCopy.data.map((record) => record.id); assert.deepEqual(ids, expectedIds, 'ids are passed to findMany'); snapshots.forEach((snapshot, index) => { - assert.strictEqual(snapshot.modelName, 'comment', 'snapshot is passed to findMany with correct modelName'); - assert.strictEqual(snapshot.id, expectedIds[index], 'snapshot is passed to findMany with correct id'); + assert.equal(snapshot.modelName, 'comment', 'snapshot is passed to findMany with correct modelName'); + assert.equal(snapshot.id, expectedIds[index], 'snapshot is passed to findMany with correct id'); }); return Promise.resolve(expectedResultCopy); @@ -461,9 +461,9 @@ module('integration/has-many - Has Many Tests', function (hooks) { data: comments.slice().map((comment) => comment.serialize().data), }; - assert.strictEqual(findRecordCalled, 0, 'findRecord is not called'); - assert.strictEqual(findManyCalled, 1, 'findMany is called once'); - assert.strictEqual(findHasManyCalled, 0, 'findHasMany is not called'); + assert.equal(findRecordCalled, 0, 'findRecord is not called'); + assert.equal(findManyCalled, 1, 'findMany is called once'); + assert.equal(findHasManyCalled, 0, 'findHasMany is not called'); assert.deepEqual(serializedComments, expectedResult, 'get returns expected result'); }); @@ -517,15 +517,15 @@ module('integration/has-many - Has Many Tests', function (hooks) { findMany(passedStore, type, ids, snapshots) { findManyCalled++; - assert.strictEqual(passedStore, store, 'instance of store is passed to findMany'); - assert.strictEqual(type, Comment, 'model is passed to findMany'); + assert.equal(passedStore, store, 'instance of store is passed to findMany'); + assert.equal(type, Comment, 'model is passed to findMany'); let expectedIds = expectedResultCopy.data.map((record) => record.id); assert.deepEqual(ids, expectedIds, 'ids are passed to findMany'); snapshots.forEach((snapshot, index) => { - assert.strictEqual(snapshot.modelName, 'comment', 'snapshot is passed to findMany with correct modelName'); - assert.strictEqual(snapshot.id, expectedIds[index], 'snapshot is passed to findMany with correct id'); + assert.equal(snapshot.modelName, 'comment', 'snapshot is passed to findMany with correct modelName'); + assert.equal(snapshot.id, expectedIds[index], 'snapshot is passed to findMany with correct id'); }); return Promise.resolve(expectedResultCopy); @@ -540,8 +540,8 @@ module('integration/has-many - Has Many Tests', function (hooks) { data: comments.slice().map((comment) => comment.serialize().data), }; - assert.strictEqual(findRecordCalled, 0, 'findRecord is not called'); - assert.strictEqual(findManyCalled, 1, 'findMany is called once'); + assert.equal(findRecordCalled, 0, 'findRecord is not called'); + assert.equal(findManyCalled, 1, 'findMany is called once'); assert.deepEqual(serializedComments, expectedResult, 'get returns expected result'); }); @@ -597,14 +597,14 @@ module('integration/has-many - Has Many Tests', function (hooks) { findHasMany(passedStore, snapshot, url, relationship) { findHasManyCalled++; - assert.strictEqual(passedStore, store, 'instance of store is passed to findHasMany'); + assert.equal(passedStore, store, 'instance of store is passed to findHasMany'); let expectedURL = initialRecord.data.relationships.comments.links.related; - assert.strictEqual(url, expectedURL, 'url is passed to findHasMany'); - assert.strictEqual(relationship.name, 'comments', 'relationship is passed to findHasMany'); + assert.equal(url, expectedURL, 'url is passed to findHasMany'); + assert.equal(relationship.name, 'comments', 'relationship is passed to findHasMany'); - assert.strictEqual(snapshot.modelName, 'post', 'snapshot is passed to findHasMany with correct modelName'); - assert.strictEqual(snapshot.id, '2', 'snapshot is passed to findHasMany with correct id'); + assert.equal(snapshot.modelName, 'post', 'snapshot is passed to findHasMany with correct modelName'); + assert.equal(snapshot.id, '2', 'snapshot is passed to findHasMany with correct id'); return Promise.resolve(expectedResultCopy); } @@ -619,9 +619,9 @@ module('integration/has-many - Has Many Tests', function (hooks) { data: comments.slice().map((comment) => comment.serialize().data), }; - assert.strictEqual(findRecordCalled, 0, 'findRecord is not called'); - assert.strictEqual(findManyCalled, 0, 'findMany is not called'); - assert.strictEqual(findHasManyCalled, 1, 'findHasMany is called once'); + assert.equal(findRecordCalled, 0, 'findRecord is not called'); + assert.equal(findManyCalled, 0, 'findMany is not called'); + assert.equal(findHasManyCalled, 1, 'findHasMany is called once'); assert.deepEqual(serializedComments, expectedResult, 'findHasMany returns expected result'); }); @@ -678,15 +678,15 @@ module('integration/has-many - Has Many Tests', function (hooks) { findMany(passedStore, type, ids, snapshots) { findManyCalled++; - assert.strictEqual(passedStore, store, 'instance of store is passed to findMany'); - assert.strictEqual(type, Comment, 'model is passed to findMany'); + assert.equal(passedStore, store, 'instance of store is passed to findMany'); + assert.equal(type, Comment, 'model is passed to findMany'); let expectedIds = expectedResultCopy.data.map((record) => record.id); assert.deepEqual(ids, expectedIds, 'ids are passed to findMany'); snapshots.forEach((snapshot, index) => { - assert.strictEqual(snapshot.modelName, 'comment', 'snapshot is passed to findMany with correct modelName'); - assert.strictEqual(snapshot.id, expectedIds[index], 'snapshot is passed to findMany with correct id'); + assert.equal(snapshot.modelName, 'comment', 'snapshot is passed to findMany with correct modelName'); + assert.equal(snapshot.id, expectedIds[index], 'snapshot is passed to findMany with correct id'); }); return Promise.resolve(expectedResultCopy); @@ -701,8 +701,8 @@ module('integration/has-many - Has Many Tests', function (hooks) { data: comments.slice().map((comment) => comment.serialize().data), }; - assert.strictEqual(findRecordCalled, 0, 'findRecord is not called'); - assert.strictEqual(findManyCalled, 1, 'findMany is called once'); + assert.equal(findRecordCalled, 0, 'findRecord is not called'); + assert.equal(findManyCalled, 1, 'findMany is called once'); assert.deepEqual(serializedComments, expectedResult, 'get returns expected result'); }); @@ -749,12 +749,12 @@ module('integration/has-many - Has Many Tests', function (hooks) { let index = findRecordCalled++; let expectedId = initialRecord.data.relationships.comments.data[index].id; - assert.strictEqual(passedStore, store, 'instance of store is passed to findRecord'); - assert.strictEqual(type, Comment, 'model is passed to findRecord'); - assert.strictEqual(id, expectedId, 'id is passed to findRecord'); + assert.equal(passedStore, store, 'instance of store is passed to findRecord'); + assert.equal(type, Comment, 'model is passed to findRecord'); + assert.equal(id, expectedId, 'id is passed to findRecord'); - assert.strictEqual(snapshot.modelName, 'comment', 'snapshot is passed to findRecord with correct modelName'); - assert.strictEqual(snapshot.id, expectedId, 'snapshot is passed to findRecord with correct id'); + assert.equal(snapshot.modelName, 'comment', 'snapshot is passed to findRecord with correct modelName'); + assert.equal(snapshot.id, expectedId, 'snapshot is passed to findRecord with correct id'); return Promise.resolve({ data: expectedResultCopy.data[index] }); } @@ -772,8 +772,8 @@ module('integration/has-many - Has Many Tests', function (hooks) { data: comments.slice().map((comment) => comment.serialize().data), }; - assert.strictEqual(findRecordCalled, 2, 'findRecord is called twice'); - assert.strictEqual(findManyCalled, 0, 'findMany is not called'); + assert.equal(findRecordCalled, 2, 'findRecord is called twice'); + assert.equal(findManyCalled, 0, 'findMany is not called'); assert.deepEqual(serializedComments, expectedResult, 'get returns expected result'); }); }); diff --git a/tests/ember-data__adapter/tests/integration/mutations-test.js b/tests/ember-data__adapter/tests/integration/mutations-test.js index 6a04ea76242..4991d59a1f7 100644 --- a/tests/ember-data__adapter/tests/integration/mutations-test.js +++ b/tests/ember-data__adapter/tests/integration/mutations-test.js @@ -1,11 +1,11 @@ import EmberObject from '@ember/object'; -import { module, test } from 'qunit'; +import { module, test } from '@warp-drive/diagnostic'; import Store from 'ember-data__adapter/services/store'; -import { setupTest } from 'ember-qunit'; import Model, { attr } from '@ember-data/model'; +import { setupTest } from '@ember-data/unpublished-test-infra/test-support/test-helpers'; class MinimalSerializer extends EmberObject { normalizeResponse(_, __, data) { @@ -61,11 +61,11 @@ module('integration/mutations - Mutations Tests', function (hooks) { let data = snapshot.serialize(); let id = snapshot.id; - assert.strictEqual(passedStore, store, 'instance of store is passed to deleteRecord'); - assert.strictEqual(type, Person, 'model is passed to deleteRecord'); - assert.strictEqual(id, '12', 'id is passed to deleteRecord through snapshot'); + assert.equal(passedStore, store, 'instance of store is passed to deleteRecord'); + assert.equal(type, Person, 'model is passed to deleteRecord'); + assert.equal(id, '12', 'id is passed to deleteRecord through snapshot'); - assert.strictEqual(snapshot.modelName, 'person', 'snapshot is passed to deleteRecord with correct modelName'); + assert.equal(snapshot.modelName, 'person', 'snapshot is passed to deleteRecord with correct modelName'); assert.deepEqual(data, expectedData, 'snapshot is passed to deleteRecord with correct data'); } } @@ -77,7 +77,7 @@ module('integration/mutations - Mutations Tests', function (hooks) { record.deleteRecord(); await record.save(); - assert.strictEqual(deleteRecordCalled, 1, 'deleteRecord is called once'); + assert.equal(deleteRecordCalled, 1, 'deleteRecord is called once'); }); test('store.deleteRecord calls adapter.deleteRecord if a newly created record is persisted, then deleted and then saved', async function (assert) { @@ -102,11 +102,11 @@ module('integration/mutations - Mutations Tests', function (hooks) { let data = snapshot.serialize(); let id = snapshot.id; - assert.strictEqual(passedStore, store, 'instance of store is passed to deleteRecord'); - assert.strictEqual(type, Person, 'model is passed to deleteRecord'); - assert.strictEqual(id, '12', 'id is passed to deleteRecord through snapshot'); + assert.equal(passedStore, store, 'instance of store is passed to deleteRecord'); + assert.equal(type, Person, 'model is passed to deleteRecord'); + assert.equal(id, '12', 'id is passed to deleteRecord through snapshot'); - assert.strictEqual(snapshot.modelName, 'person', 'snapshot is passed to deleteRecord with correct modelName'); + assert.equal(snapshot.modelName, 'person', 'snapshot is passed to deleteRecord with correct modelName'); assert.deepEqual(data, expectedData, 'snapshot is passed to deleteRecord with correct data'); return Promise.resolve(data); @@ -118,11 +118,11 @@ module('integration/mutations - Mutations Tests', function (hooks) { let data = snapshot.serialize(); let id = snapshot.id; - assert.strictEqual(passedStore, store, 'instance of store is passed to deleteRecord'); - assert.strictEqual(type, Person, 'model is passed to deleteRecord'); - assert.strictEqual(id, '12', 'id is passed to deleteRecord through snapshot'); + assert.equal(passedStore, store, 'instance of store is passed to deleteRecord'); + assert.equal(type, Person, 'model is passed to deleteRecord'); + assert.equal(id, '12', 'id is passed to deleteRecord through snapshot'); - assert.strictEqual(snapshot.modelName, 'person', 'snapshot is passed to deleteRecord with correct modelName'); + assert.equal(snapshot.modelName, 'person', 'snapshot is passed to deleteRecord with correct modelName'); assert.deepEqual(data, expectedData, 'snapshot is passed to deleteRecord with correct data'); } } @@ -133,12 +133,12 @@ module('integration/mutations - Mutations Tests', function (hooks) { let record = store.createRecord('person', props); await record.save(); - assert.strictEqual(createRecordCalled, 1, 'createRecord is called once'); + assert.equal(createRecordCalled, 1, 'createRecord is called once'); record.deleteRecord(); await record.save(); - assert.strictEqual(deleteRecordCalled, 1, 'deleteRecord is called once'); + assert.equal(deleteRecordCalled, 1, 'deleteRecord is called once'); }); test('store.deleteRecord does not call adapter.deleteRecord if a newly created, unpersisted record is deleted and then saved', async function (assert) { @@ -174,8 +174,8 @@ module('integration/mutations - Mutations Tests', function (hooks) { record.deleteRecord(); await record.save(); - assert.strictEqual(createRecordCalled, 0, 'adapter.createRecord is not called'); - assert.strictEqual(deleteRecordCalled, 0, 'adapter.deleteRecord is not called'); + assert.equal(createRecordCalled, 0, 'adapter.createRecord is not called'); + assert.equal(deleteRecordCalled, 0, 'adapter.deleteRecord is not called'); }); test('record.save() calls adapter.createRecord if a newly created record unpersisted record is saved', async function (assert) { @@ -199,11 +199,11 @@ module('integration/mutations - Mutations Tests', function (hooks) { let data = snapshot.serialize(); let id = snapshot.id; - assert.strictEqual(passedStore, store, 'instance of store is passed to deleteRecord'); - assert.strictEqual(type, Person, 'model is passed to deleteRecord'); - assert.strictEqual(id, '12', 'id is passed to deleteRecord through snapshot'); + assert.equal(passedStore, store, 'instance of store is passed to deleteRecord'); + assert.equal(type, Person, 'model is passed to deleteRecord'); + assert.equal(id, '12', 'id is passed to deleteRecord through snapshot'); - assert.strictEqual(snapshot.modelName, 'person', 'snapshot is passed to deleteRecord with correct modelName'); + assert.equal(snapshot.modelName, 'person', 'snapshot is passed to deleteRecord with correct modelName'); assert.deepEqual(data, expectedData, 'snapshot is passed to deleteRecord with correct data'); return Promise.resolve(data); @@ -216,7 +216,7 @@ module('integration/mutations - Mutations Tests', function (hooks) { let record = store.createRecord('person', props); await record.save(); - assert.strictEqual(createRecordCalled, 1, 'createRecord is called once'); + assert.equal(createRecordCalled, 1, 'createRecord is called once'); }); test('record.save() calls adapter.createRecord then adapter.updateRecord if a newly created record record is saved, then saved again', async function (assert) { @@ -241,11 +241,11 @@ module('integration/mutations - Mutations Tests', function (hooks) { let data = snapshot.serialize(); let id = snapshot.id; - assert.strictEqual(passedStore, store, 'instance of store is passed to deleteRecord'); - assert.strictEqual(type, Person, 'model is passed to deleteRecord'); - assert.strictEqual(id, '12', 'id is passed to deleteRecord through snapshot'); + assert.equal(passedStore, store, 'instance of store is passed to deleteRecord'); + assert.equal(type, Person, 'model is passed to deleteRecord'); + assert.equal(id, '12', 'id is passed to deleteRecord through snapshot'); - assert.strictEqual(snapshot.modelName, 'person', 'snapshot is passed to deleteRecord with correct modelName'); + assert.equal(snapshot.modelName, 'person', 'snapshot is passed to deleteRecord with correct modelName'); assert.deepEqual(data, expectedData, 'snapshot is passed to deleteRecord with correct data'); return Promise.resolve(data); @@ -257,11 +257,11 @@ module('integration/mutations - Mutations Tests', function (hooks) { let data = snapshot.serialize(); let id = snapshot.id; - assert.strictEqual(passedStore, store, 'instance of store is passed to deleteRecord'); - assert.strictEqual(type, Person, 'model is passed to deleteRecord'); - assert.strictEqual(id, '12', 'id is passed to deleteRecord through snapshot'); + assert.equal(passedStore, store, 'instance of store is passed to deleteRecord'); + assert.equal(type, Person, 'model is passed to deleteRecord'); + assert.equal(id, '12', 'id is passed to deleteRecord through snapshot'); - assert.strictEqual(snapshot.modelName, 'person', 'snapshot is passed to deleteRecord with correct modelName'); + assert.equal(snapshot.modelName, 'person', 'snapshot is passed to deleteRecord with correct modelName'); assert.deepEqual(data, expectedData, 'snapshot is passed to deleteRecord with correct data'); return Promise.resolve(expectedData); @@ -274,14 +274,14 @@ module('integration/mutations - Mutations Tests', function (hooks) { let record = store.createRecord('person', props); await record.save(); - assert.strictEqual(createRecordCalled, 1, 'createRecord is called once'); + assert.equal(createRecordCalled, 1, 'createRecord is called once'); record.firstName = 'Kevin'; expectedData.data.attributes.firstName = 'Kevin'; await record.save(); - assert.strictEqual(createRecordCalled, 1, 'createRecord is not called again'); - assert.strictEqual(updateRecord, 1, 'updateRecord is called once'); + assert.equal(createRecordCalled, 1, 'createRecord is not called again'); + assert.equal(updateRecord, 1, 'updateRecord is called once'); }); test('record.save() calls adapter.updateRecord if an existing persisted record is saved', async function (assert) { @@ -310,11 +310,11 @@ module('integration/mutations - Mutations Tests', function (hooks) { let data = snapshot.serialize(); let id = snapshot.id; - assert.strictEqual(passedStore, store, 'instance of store is passed to deleteRecord'); - assert.strictEqual(type, Person, 'model is passed to deleteRecord'); - assert.strictEqual(id, '12', 'id is passed to deleteRecord through snapshot'); + assert.equal(passedStore, store, 'instance of store is passed to deleteRecord'); + assert.equal(type, Person, 'model is passed to deleteRecord'); + assert.equal(id, '12', 'id is passed to deleteRecord through snapshot'); - assert.strictEqual(snapshot.modelName, 'person', 'snapshot is passed to deleteRecord with correct modelName'); + assert.equal(snapshot.modelName, 'person', 'snapshot is passed to deleteRecord with correct modelName'); assert.deepEqual(data, expectedData, 'snapshot is passed to deleteRecord with correct data'); return Promise.resolve(expectedData); @@ -329,7 +329,7 @@ module('integration/mutations - Mutations Tests', function (hooks) { expectedData.data.attributes.firstName = 'Kevin'; await record.save(); - assert.strictEqual(createRecordCalled, 0, 'createRecord is not called'); - assert.strictEqual(updateRecord, 1, 'updateRecord is called once'); + assert.equal(createRecordCalled, 0, 'createRecord is not called'); + assert.equal(updateRecord, 1, 'updateRecord is called once'); }); }); diff --git a/tests/ember-data__adapter/tests/integration/queries-test.js b/tests/ember-data__adapter/tests/integration/queries-test.js index 9f9eaaccffe..5ae22004e92 100644 --- a/tests/ember-data__adapter/tests/integration/queries-test.js +++ b/tests/ember-data__adapter/tests/integration/queries-test.js @@ -1,12 +1,12 @@ import EmberObject from '@ember/object'; -import { module, test } from 'qunit'; +import { module, test } from '@warp-drive/diagnostic'; import Store from 'ember-data__adapter/services/store'; -import { setupTest } from 'ember-qunit'; import Model, { attr } from '@ember-data/model'; import deepCopy from '@ember-data/unpublished-test-infra/test-support/deep-copy'; +import { setupTest } from '@ember-data/unpublished-test-infra/test-support/test-helpers'; class MinimalSerializer extends EmberObject { normalizeResponse(_, __, data) { @@ -62,8 +62,8 @@ module('integration/queries - Queries Tests', function (hooks) { adapterOptions ||= {}; adapterOptions.otherOption = 'baz'; - assert.strictEqual(query.initialOption, 'bar', 'query is mutated'); - assert.strictEqual(adapterOptions.otherOption, 'baz', 'adapterOptions is mutated'); + assert.equal(query.initialOption, 'bar', 'query is mutated'); + assert.equal(adapterOptions.otherOption, 'baz', 'adapterOptions is mutated'); return Promise.resolve({ data: [expectedResult], @@ -76,8 +76,8 @@ module('integration/queries - Queries Tests', function (hooks) { adapterOptions ||= {}; adapterOptions.otherOption = 'baz'; - assert.strictEqual(query.initialOption, 'bar', 'query is mutated'); - assert.strictEqual(adapterOptions.otherOption, 'baz', 'adapterOptions is mutated'); + assert.equal(query.initialOption, 'bar', 'query is mutated'); + assert.equal(adapterOptions.otherOption, 'baz', 'adapterOptions is mutated'); return Promise.resolve({ data: expectedResult, @@ -117,12 +117,12 @@ module('integration/queries - Queries Tests', function (hooks) { findRecord(passedStore, type, id, snapshot) { findRecordCalled++; - assert.strictEqual(passedStore, store, 'instance of store is passed to findRecord'); - assert.strictEqual(type, Person, 'model is passed to findRecord'); - assert.strictEqual(id, '12', 'id is passed to findRecord'); + assert.equal(passedStore, store, 'instance of store is passed to findRecord'); + assert.equal(type, Person, 'model is passed to findRecord'); + assert.equal(id, '12', 'id is passed to findRecord'); - assert.strictEqual(snapshot.modelName, 'person', 'snapshot is passed to findRecord with correct modelName'); - assert.strictEqual(snapshot.id, '12', 'snapshot is passed to findRecord with correct id'); + assert.equal(snapshot.modelName, 'person', 'snapshot is passed to findRecord with correct modelName'); + assert.equal(snapshot.id, '12', 'snapshot is passed to findRecord with correct id'); return Promise.resolve(expectedResultCopy); } @@ -132,7 +132,7 @@ module('integration/queries - Queries Tests', function (hooks) { let record = await store.findRecord('person', '12'); - assert.strictEqual(findRecordCalled, 1, 'findRecord is called once'); + assert.equal(findRecordCalled, 1, 'findRecord is called once'); assert.deepEqual(record.serialize(), expectedResult, 'findRecord returns expected result'); }); @@ -171,11 +171,11 @@ module('integration/queries - Queries Tests', function (hooks) { findAll(passedStore, type, sinceToken, snapshot) { findAllCalled++; - assert.strictEqual(passedStore, store, 'instance of store is passed to findAll'); - assert.strictEqual(type, Person, 'model is passed to findAll'); - assert.strictEqual(sinceToken, null, 'sinceToken passed to findAll is null'); - assert.strictEqual(snapshot.modelName, 'person', 'snapshot is passed to findAll with correct modelName'); - assert.strictEqual(snapshot.length, 0, 'snapshot is passed to findAll represnts empty array'); + assert.equal(passedStore, store, 'instance of store is passed to findAll'); + assert.equal(type, Person, 'model is passed to findAll'); + assert.equal(sinceToken, null, 'sinceToken passed to findAll is null'); + assert.equal(snapshot.modelName, 'person', 'snapshot is passed to findAll with correct modelName'); + assert.equal(snapshot.length, 0, 'snapshot is passed to findAll represnts empty array'); return Promise.resolve(expectedResultCopy); } @@ -188,7 +188,7 @@ module('integration/queries - Queries Tests', function (hooks) { let result = manyArray.slice().map((person) => person.serialize()); expectedResult = expectedResult.data.map((person) => ({ data: person })); - assert.strictEqual(findAllCalled, 1, 'findAll is called once'); + assert.equal(findAllCalled, 1, 'findAll is called once'); assert.deepEqual(result, expectedResult, 'findAll returns expected result'); }); @@ -211,8 +211,8 @@ module('integration/queries - Queries Tests', function (hooks) { queryRecord(passedStore, type, query, options) { queryRecordCalled++; - assert.strictEqual(passedStore, store, 'instance of store is passed to queryRecord'); - assert.strictEqual(type, Person, 'model is passed to queryRecord'); + assert.equal(passedStore, store, 'instance of store is passed to queryRecord'); + assert.equal(type, Person, 'model is passed to queryRecord'); assert.deepEqual(query, { firstName: 'Gaurav' }, 'query is passed to queryRecord'); assert.deepEqual(options, {}, 'options is passsed to queryRecord'); @@ -224,7 +224,7 @@ module('integration/queries - Queries Tests', function (hooks) { let record = await store.queryRecord('person', { firstName: 'Gaurav' }); - assert.strictEqual(queryRecordCalled, 1, 'queryRecord is called once'); + assert.equal(queryRecordCalled, 1, 'queryRecord is called once'); assert.deepEqual(record.serialize(), expectedResult, 'queryRecord returns expected result'); }); @@ -257,8 +257,8 @@ module('integration/queries - Queries Tests', function (hooks) { query(passedStore, type, query, recordArray, options) { queryCalled++; - assert.strictEqual(passedStore, store, 'instance of store is passed to query'); - assert.strictEqual(type, Person, 'model is passed to query'); + assert.equal(passedStore, store, 'instance of store is passed to query'); + assert.equal(type, Person, 'model is passed to query'); assert.deepEqual(query, { firstName: 'Chris' }, 'query is passed to query'); assert.deepEqual(recordArray.slice(), [], 'recordArray is passsed to query'); assert.deepEqual(options, {}, 'options is passed to query'); @@ -274,7 +274,7 @@ module('integration/queries - Queries Tests', function (hooks) { let result = manyArray.slice().map((person) => person.serialize()); expectedResult = expectedResult.data.map((person) => ({ data: person })); - assert.strictEqual(queryCalled, 1, 'query is called once'); + assert.equal(queryCalled, 1, 'query is called once'); assert.deepEqual(result, expectedResult, 'query returns expected result'); }); }); diff --git a/tests/ember-data__adapter/tests/integration/reload-test.js b/tests/ember-data__adapter/tests/integration/reload-test.js index 94ef4ec755b..dbf761cdcc0 100644 --- a/tests/ember-data__adapter/tests/integration/reload-test.js +++ b/tests/ember-data__adapter/tests/integration/reload-test.js @@ -1,11 +1,11 @@ import EmberObject from '@ember/object'; -import { module, test } from 'qunit'; +import { module, test } from '@warp-drive/diagnostic'; import Store from 'ember-data__adapter/services/store'; -import { setupTest } from 'ember-qunit'; import Model, { attr } from '@ember-data/model'; +import { setupTest } from '@ember-data/unpublished-test-infra/test-support/test-helpers'; class MinimalSerializer extends EmberObject { normalizeResponse(_, __, data) { @@ -95,8 +95,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findAll('person', { reload: false }); - assert.strictEqual(this.adapter.shouldReloadAllCalled, 0, 'shouldReloadAll is not called'); - assert.strictEqual(this.adapter.requestsMade, 0, 'no request is made'); + assert.equal(this.adapter.shouldReloadAllCalled, 0, 'shouldReloadAll is not called'); + assert.equal(this.adapter.requestsMade, 0, 'no request is made'); }); test('adapter.shouldReloadAll is not called when store.findAll is called with a reload: true flag', async function (assert) { @@ -107,8 +107,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findAll('person', { reload: true }); - assert.strictEqual(this.adapter.shouldReloadAllCalled, 0, 'shouldReloadAll is not called'); - assert.strictEqual(this.adapter.requestsMade, 1, 'an ajax request is made'); + assert.equal(this.adapter.shouldReloadAllCalled, 0, 'shouldReloadAll is not called'); + assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made'); }); test('store.findAll does not error if adapter.shouldReloadAll is not defined (records are present)', async function (assert) { @@ -129,7 +129,7 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findAll('person'); - assert.strictEqual(this.adapter.requestsMade, 0, 'no ajax request is made'); + assert.equal(this.adapter.requestsMade, 0, 'no ajax request is made'); }); test('store.findAll does not error if adapter.shouldReloadAll is not defined (records are absent)', async function (assert) { @@ -139,7 +139,7 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findAll('person'); - assert.strictEqual(this.adapter.requestsMade, 1, 'an ajax request is made'); + assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made'); }); test('adapter.shouldReloadAll is called when store.findAll is called without a reload flag (shouldReloadAll is false)', async function (assert) { @@ -150,11 +150,11 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findAll('person'); - assert.strictEqual(this.adapter.shouldReloadAllCalled, 1, 'shouldReloadAll is called'); - assert.strictEqual(this.adapter.requestsMade, 0, 'no ajax request is made'); + assert.equal(this.adapter.shouldReloadAllCalled, 1, 'shouldReloadAll is called'); + assert.equal(this.adapter.requestsMade, 0, 'no ajax request is made'); }); - test('adapter.shouldReloadAll is called when store.findAll is called without a reload flag (shouldReloadAll is false)', async function (assert) { + test('adapter.shouldReloadAll is called when store.findAll is called without a reload flag (shouldReloadAll is true)', async function (assert) { setupReloadTest.call(this, { shouldReloadAll: true, shouldBackgroundReloadAll: false, @@ -162,8 +162,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findAll('person'); - assert.strictEqual(this.adapter.shouldReloadAllCalled, 1, 'shouldReloadAll is called'); - assert.strictEqual(this.adapter.requestsMade, 1, 'an ajax request is made'); + assert.equal(this.adapter.shouldReloadAllCalled, 1, 'shouldReloadAll is called'); + assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made'); }); }); @@ -173,8 +173,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findAll('person', { reload: true }); - assert.strictEqual(this.adapter.shouldBackgroundReloadAllCalled, 0, 'shouldBackgroundReloadAll not called'); - assert.strictEqual(this.adapter.requestsMade, 1, 'an ajax request is made'); + assert.equal(this.adapter.shouldBackgroundReloadAllCalled, 0, 'shouldBackgroundReloadAll not called'); + assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made'); }); test('adapter.shouldBackgroundReloadAll is not called called when store.findAll is called and adaptershouldReloadAll() returns true (but we do make request)', async function (assert) { @@ -184,8 +184,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findAll('person'); - assert.strictEqual(this.adapter.shouldBackgroundReloadAllCalled, 0, 'shouldBackgroundReloadAll not called'); - assert.strictEqual(this.adapter.requestsMade, 1, 'an ajax request is made'); + assert.equal(this.adapter.shouldBackgroundReloadAllCalled, 0, 'shouldBackgroundReloadAll not called'); + assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made'); }); test('adapter.shouldBackgroundReloadAll is not called when store.findAll is called with backroundReload: true', async function (assert) { @@ -195,8 +195,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findAll('person', { backgroundReload: true }); - assert.strictEqual(this.adapter.shouldBackgroundReloadAllCalled, 0, 'shouldBackgroundReloadAll is not called'); - assert.strictEqual(this.adapter.requestsMade, 1, 'an ajax request is made'); + assert.equal(this.adapter.shouldBackgroundReloadAllCalled, 0, 'shouldBackgroundReloadAll is not called'); + assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made'); }); test('adapter.shouldBackgroundReloadAll is not called when store.findAll is called with backroundReload: false', async function (assert) { @@ -206,8 +206,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findAll('person', { backgroundReload: false }); - assert.strictEqual(this.adapter.shouldBackgroundReloadAllCalled, 0, 'shouldBackgroundReloadAll is not called'); - assert.strictEqual(this.adapter.requestsMade, 0, 'no ajax request is made'); + assert.equal(this.adapter.shouldBackgroundReloadAllCalled, 0, 'shouldBackgroundReloadAll is not called'); + assert.equal(this.adapter.requestsMade, 0, 'no ajax request is made'); }); test('store.findAll does not error if adapter.shouldBackgroundReloadAll is undefined and backgroundReload is not present.', async function (assert) { @@ -217,7 +217,7 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findAll('person'); - assert.strictEqual(this.adapter.requestsMade, 1, 'an ajax request is made'); + assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made'); }); test('adapter.shouldBackgroundReloadAll is called when store.findAll is called and there is no backgroundReload flag (returns true)', async function (assert) { @@ -228,8 +228,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findAll('person'); - assert.strictEqual(this.adapter.shouldBackgroundReloadAllCalled, 1, 'shouldBackgroundReloadAll is called'); - assert.strictEqual(this.adapter.requestsMade, 1, 'an ajax request is made'); + assert.equal(this.adapter.shouldBackgroundReloadAllCalled, 1, 'shouldBackgroundReloadAll is called'); + assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made'); }); test('adapter.shouldBackgroundReloadAll is called when store.findAll is called and there is no backgroundReload flag (returns false)', async function (assert) { @@ -240,8 +240,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findAll('person'); - assert.strictEqual(this.adapter.shouldBackgroundReloadAllCalled, 1, 'shouldBackgroundReloadAll is called'); - assert.strictEqual(this.adapter.requestsMade, 0, 'no ajax request is made'); + assert.equal(this.adapter.shouldBackgroundReloadAllCalled, 1, 'shouldBackgroundReloadAll is called'); + assert.equal(this.adapter.requestsMade, 0, 'no ajax request is made'); }); }); @@ -269,8 +269,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findRecord('person', '1'); - assert.strictEqual(this.adapter.shouldReloadRecordCalled, 0, 'shouldReloadRecord is not called'); - assert.strictEqual(this.adapter.requestsMade, 1, 'an ajax request is made'); + assert.equal(this.adapter.shouldReloadRecordCalled, 0, 'shouldReloadRecord is not called'); + assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made'); }); test('adapter.shouldReloadRecord is not called when store.findRecord is called for a never loaded record (but we do make request)', async function (assert) { @@ -292,8 +292,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findRecord('person', '1'); - assert.strictEqual(this.adapter.shouldReloadRecordCalled, 0, 'shouldReloadRecord is not called'); - assert.strictEqual(this.adapter.requestsMade, 1, 'an ajax request is made'); + assert.equal(this.adapter.shouldReloadRecordCalled, 0, 'shouldReloadRecord is not called'); + assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made'); }); test('adapter.shouldReloadRecord is not called when store.findRecord is called with a reload flag (but we do make request if reload is true)', async function (assert) { @@ -317,8 +317,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findRecord('person', '1', { reload: true }); - assert.strictEqual(this.adapter.shouldReloadRecordCalled, 0, 'shouldReloadRecord is not called'); - assert.strictEqual(this.adapter.requestsMade, 1, 'an ajax request is made'); + assert.equal(this.adapter.shouldReloadRecordCalled, 0, 'shouldReloadRecord is not called'); + assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made'); }); test('adapter.shouldReloadRecord is not called when store.findRecord is called with a reload flag (and we do not make request if reload is false)', async function (assert) { @@ -342,8 +342,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findRecord('person', '1', { reload: false }); - assert.strictEqual(this.adapter.shouldReloadRecordCalled, 0, 'shouldReloadRecord is not called'); - assert.strictEqual(this.adapter.requestsMade, 0, 'no ajax request is made'); + assert.equal(this.adapter.shouldReloadRecordCalled, 0, 'shouldReloadRecord is not called'); + assert.equal(this.adapter.requestsMade, 0, 'no ajax request is made'); }); test('if adapter.shouldReloadRecord is undefined, we default to false and do not make a request', async function (assert) { @@ -367,8 +367,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findRecord('person', '1'); - assert.strictEqual(this.adapter.shouldReloadRecordCalled, 0, 'shouldReloadRecord is not called'); - assert.strictEqual(this.adapter.requestsMade, 0, 'no ajax request is made'); + assert.equal(this.adapter.shouldReloadRecordCalled, 0, 'shouldReloadRecord is not called'); + assert.equal(this.adapter.requestsMade, 0, 'no ajax request is made'); }); test('adapter.shouldReloadRecord is called when store.findRecord is called without a reload flag (shouldReloadRecord returns true)', async function (assert) { @@ -393,8 +393,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findRecord('person', '1'); - assert.strictEqual(this.adapter.shouldReloadRecordCalled, 1, 'shouldReloadRecord is called'); - assert.strictEqual(this.adapter.requestsMade, 1, 'an ajax request is made'); + assert.equal(this.adapter.shouldReloadRecordCalled, 1, 'shouldReloadRecord is called'); + assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made'); }); test('adapter.shouldReloadRecord is called when store.findRecord is called without a reload flag (shouldReloadRecord returns false)', async function (assert) { @@ -419,8 +419,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findRecord('person', '1'); - assert.strictEqual(this.adapter.shouldReloadRecordCalled, 1, 'shouldReloadRecord is called'); - assert.strictEqual(this.adapter.requestsMade, 0, 'no ajax request is made'); + assert.equal(this.adapter.shouldReloadRecordCalled, 1, 'shouldReloadRecord is called'); + assert.equal(this.adapter.requestsMade, 0, 'no ajax request is made'); }); }); @@ -447,12 +447,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findRecord('person', '1'); - assert.strictEqual( - this.adapter.shouldBackgroundReloadRecordCalled, - 0, - 'shouldBackgroundReloadRecord is not called' - ); - assert.strictEqual(this.adapter.requestsMade, 1, 'an ajax request is made'); + assert.equal(this.adapter.shouldBackgroundReloadRecordCalled, 0, 'shouldBackgroundReloadRecord is not called'); + assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made'); }); test('adapter.shouldBackgroundReloadRecord is not called when store.findRecord is called for a never loaded record (but we do make request)', async function (assert) { @@ -473,12 +469,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findRecord('person', '1'); - assert.strictEqual( - this.adapter.shouldBackgroundReloadRecordCalled, - 0, - 'shouldBackgroundReloadRecord is not called' - ); - assert.strictEqual(this.adapter.requestsMade, 1, 'an ajax request is made'); + assert.equal(this.adapter.shouldBackgroundReloadRecordCalled, 0, 'shouldBackgroundReloadRecord is not called'); + assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made'); }); test('adapter.shouldBackgroundReloadRecord is not called called when store.findRecord is called with reload: true flag (but we do make request)', async function (assert) { @@ -501,12 +493,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findRecord('person', '1', { reload: true }); - assert.strictEqual( - this.adapter.shouldBackgroundReloadRecordCalled, - 0, - 'shouldBackgroundReloadRecord is not called' - ); - assert.strictEqual(this.adapter.requestsMade, 1, 'an ajax request is made'); + assert.equal(this.adapter.shouldBackgroundReloadRecordCalled, 0, 'shouldBackgroundReloadRecord is not called'); + assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made'); }); test('adapter.shouldBackgroundReloadRecord is not called called when store.findRecord is called and shouldReloadRecord returns true (but we do make request)', async function (assert) { @@ -530,12 +518,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findRecord('person', '1'); - assert.strictEqual( - this.adapter.shouldBackgroundReloadRecordCalled, - 0, - 'shouldBackgroundReloadRecord is not called' - ); - assert.strictEqual(this.adapter.requestsMade, 1, 'an ajax request is made'); + assert.equal(this.adapter.shouldBackgroundReloadRecordCalled, 0, 'shouldBackgroundReloadRecord is not called'); + assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made'); }); test('adapter.shouldBackgroundReloadRecord is not called when store.findRecord is called with backroundReload as an option (backgroundReload is true)', async function (assert) { @@ -559,12 +543,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findRecord('person', '1', { backgroundReload: true }); await this.store._getAllPending(); - assert.strictEqual( - this.adapter.shouldBackgroundReloadRecordCalled, - 0, - 'shouldBackgroundReloadRecord is not called' - ); - assert.strictEqual(this.adapter.requestsMade, 1, 'an ajax request is made'); + assert.equal(this.adapter.shouldBackgroundReloadRecordCalled, 0, 'shouldBackgroundReloadRecord is not called'); + assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made'); }); test('adapter.shouldBackgroundReloadRecord is not called when store.findRecord is called with backroundReload as an option (backgroundReload is false)', async function (assert) { @@ -587,12 +567,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findRecord('person', '1', { backgroundReload: false }); - assert.strictEqual( - this.adapter.shouldBackgroundReloadRecordCalled, - 0, - 'shouldBackgroundReloadRecord is not called' - ); - assert.strictEqual(this.adapter.requestsMade, 0, 'no ajax request is made'); + assert.equal(this.adapter.shouldBackgroundReloadRecordCalled, 0, 'shouldBackgroundReloadRecord is not called'); + assert.equal(this.adapter.requestsMade, 0, 'no ajax request is made'); }); test('store.findRecord does not error if adapter.shouldBackgroundReloadRecord is undefined and backgroundReload is not present.', async function (assert) { @@ -616,7 +592,7 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findRecord('person', '1'); await this.store._getAllPending(); - assert.strictEqual(this.adapter.requestsMade, 1, 'an ajax request is made'); + assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made'); }); test('adapter.shouldBackgroundReloadRecord is called when store.findRecord is called and there is no backgroundReload flag (adapter.shouldBackgroundReloadRecord() returns true)', async function (assert) { @@ -641,8 +617,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findRecord('person', '1'); await this.store._getAllPending(); - assert.strictEqual(this.adapter.shouldBackgroundReloadRecordCalled, 1, 'shouldBackgroundReloadRecord is called'); - assert.strictEqual(this.adapter.requestsMade, 1, 'an ajax request is made'); + assert.equal(this.adapter.shouldBackgroundReloadRecordCalled, 1, 'shouldBackgroundReloadRecord is called'); + assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made'); }); test('adapter.shouldBackgroundReloadRecord is called when store.findRecord is called and there is no backgroundReload flag (adapter.shouldBackgroundReloadRecord() returns false)', async function (assert) { @@ -666,8 +642,8 @@ module('integration/reload - Reloading Tests', function (hooks) { await this.store.findRecord('person', '1'); - assert.strictEqual(this.adapter.shouldBackgroundReloadRecordCalled, 1, 'shouldBackgroundReloadRecord is called'); - assert.strictEqual(this.adapter.requestsMade, 0, 'no ajax request is made'); + assert.equal(this.adapter.shouldBackgroundReloadRecordCalled, 1, 'shouldBackgroundReloadRecord is called'); + assert.equal(this.adapter.requestsMade, 0, 'no ajax request is made'); }); }); }); diff --git a/tests/ember-data__adapter/tests/test-helper.js b/tests/ember-data__adapter/tests/test-helper.js index bffc9f847f4..e6cbd658d30 100644 --- a/tests/ember-data__adapter/tests/test-helper.js +++ b/tests/ember-data__adapter/tests/test-helper.js @@ -1,19 +1,62 @@ import { setApplication } from '@ember/test-helpers'; -import * as QUnit from 'qunit'; -import { setup } from 'qunit-dom'; +import { setupGlobalHooks } from '@warp-drive/diagnostic'; +import { start } from '@warp-drive/diagnostic/runners/dom'; -import { start } from 'ember-qunit'; +import AbstractTestLoader from 'ember-cli-test-loader/test-support/index'; import configureAsserts from '@ember-data/unpublished-test-infra/test-support/asserts'; import Application from '../app'; import config from '../config/environment'; -setup(QUnit.assert); -configureAsserts(QUnit.hooks); +let moduleLoadFailures = []; -setApplication(Application.create(config.APP)); +setupGlobalHooks((hooks) => { + configureAsserts(hooks); + hooks.onSuiteFinish(() => { + let length = moduleLoadFailures.length; + + try { + if (length === 0) { + // do nothing + } else if (length === 1) { + throw moduleLoadFailures[0]; + } else { + throw new Error('\n' + moduleLoadFailures.join('\n')); + } + } finally { + // ensure we release previously captured errors. + moduleLoadFailures = []; + } + }); +}); + +export class TestLoader extends AbstractTestLoader { + moduleLoadFailure(moduleName, error) { + moduleLoadFailures.push(error); + } +} + +/** + Load tests following the default patterns: -QUnit.config.testTimeout = 2000; -start({ setupTestIsolationValidation: true }); + * The module name ends with `-test` + * The module name ends with `.jshint` + + @method loadTests + */ +export function loadTests() { + new TestLoader().loadModules(); +} + +loadTests(); + +setApplication(Application.create(config.APP)); +start({ + tryCatch: true, + groupLogs: false, + instrument: true, + hideReport: false, + useDiagnostic: true, +}); diff --git a/tests/ember-data__adapter/tests/unit/.gitkeep b/tests/ember-data__adapter/tests/unit/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/ember-data__adapter/vendor/.gitkeep b/tests/ember-data__adapter/vendor/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 From 3d3ed00f28fd1fa6c5f994c8ee8f5add4fe6b6ca Mon Sep 17 00:00:00 2001 From: Chris Thoburn Date: Wed, 18 Oct 2023 00:00:54 -0700 Subject: [PATCH 2/3] tweak settings --- tests/ember-data__adapter/diagnostic.js | 4 +--- tests/ember-data__adapter/tests/test-helper.js | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/ember-data__adapter/diagnostic.js b/tests/ember-data__adapter/diagnostic.js index 9084fb02e58..ede75dbb1ad 100644 --- a/tests/ember-data__adapter/diagnostic.js +++ b/tests/ember-data__adapter/diagnostic.js @@ -1,5 +1,3 @@ import launch from '@warp-drive/diagnostic/server/default-setup.js'; -await launch({ - headless: false, -}); +await launch(); diff --git a/tests/ember-data__adapter/tests/test-helper.js b/tests/ember-data__adapter/tests/test-helper.js index e6cbd658d30..829ee9070c7 100644 --- a/tests/ember-data__adapter/tests/test-helper.js +++ b/tests/ember-data__adapter/tests/test-helper.js @@ -54,9 +54,9 @@ loadTests(); setApplication(Application.create(config.APP)); start({ - tryCatch: true, + tryCatch: false, groupLogs: false, instrument: true, - hideReport: false, + hideReport: true, useDiagnostic: true, }); From d74e6c52862146957fbc944233080bc5fabaf314 Mon Sep 17 00:00:00 2001 From: Chris Thoburn Date: Wed, 18 Oct 2023 00:18:54 -0700 Subject: [PATCH 3/3] speedy --- .eslintrc.js | 1 + .../src/failed-test-log.txt | 0 pnpm-lock.yaml | 20 ++--- tests/ember-data__model/.gitignore | 25 ------ tests/ember-data__model/.template-lintrc.js | 5 -- tests/ember-data__model/.watchmanconfig | 3 - .../ember-data__model/app/components/.gitkeep | 0 .../app/controllers/.gitkeep | 0 tests/ember-data__model/app/helpers/.gitkeep | 0 tests/ember-data__model/app/models/.gitkeep | 0 tests/ember-data__model/app/routes/.gitkeep | 0 .../app/templates/components/.gitkeep | 0 tests/ember-data__model/diagnostic.js | 3 + tests/ember-data__model/ember-cli-build.js | 5 ++ tests/ember-data__model/package.json | 16 ++-- tests/ember-data__model/public/robots.txt | 3 - tests/ember-data__model/testem.js | 24 ------ .../ember-data__model/tests/helpers/.gitkeep | 0 tests/ember-data__model/tests/index.html | 13 ++- .../tests/integration/.gitkeep | 0 .../{model-for-test.js => model-for-test.ts} | 79 +++++++++---------- tests/ember-data__model/tests/test-helper.js | 57 ++++++++++--- tests/ember-data__model/tests/unit/.gitkeep | 0 tests/ember-data__model/vendor/.gitkeep | 0 tests/ember-data__request/testem.js | 7 -- 25 files changed, 109 insertions(+), 152 deletions(-) rename tests/ember-data__adapter/app/routes/.gitkeep => packages/unpublished-test-infra/src/failed-test-log.txt (100%) delete mode 100644 tests/ember-data__model/.gitignore delete mode 100644 tests/ember-data__model/.template-lintrc.js delete mode 100644 tests/ember-data__model/.watchmanconfig delete mode 100644 tests/ember-data__model/app/components/.gitkeep delete mode 100644 tests/ember-data__model/app/controllers/.gitkeep delete mode 100644 tests/ember-data__model/app/helpers/.gitkeep delete mode 100644 tests/ember-data__model/app/models/.gitkeep delete mode 100644 tests/ember-data__model/app/routes/.gitkeep delete mode 100644 tests/ember-data__model/app/templates/components/.gitkeep create mode 100644 tests/ember-data__model/diagnostic.js delete mode 100644 tests/ember-data__model/public/robots.txt delete mode 100644 tests/ember-data__model/testem.js delete mode 100644 tests/ember-data__model/tests/helpers/.gitkeep delete mode 100644 tests/ember-data__model/tests/integration/.gitkeep rename tests/ember-data__model/tests/integration/{model-for-test.js => model-for-test.ts} (54%) delete mode 100644 tests/ember-data__model/tests/unit/.gitkeep delete mode 100644 tests/ember-data__model/vendor/.gitkeep delete mode 100644 tests/ember-data__request/testem.js diff --git a/.eslintrc.js b/.eslintrc.js index ce27ac6f8cc..2d04f08daaa 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -109,6 +109,7 @@ module.exports = { 'tests/ember-data__graph/**', 'tests/ember-data__request/**', 'tests/ember-data__adapter/**', + 'tests/ember-data__model/**', 'tests/builders/**', ], rules: { diff --git a/tests/ember-data__adapter/app/routes/.gitkeep b/packages/unpublished-test-infra/src/failed-test-log.txt similarity index 100% rename from tests/ember-data__adapter/app/routes/.gitkeep rename to packages/unpublished-test-infra/src/failed-test-log.txt diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c305f1ca127..96dcf8fa447 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2250,9 +2250,6 @@ importers: '@ember-data/tracking': specifier: workspace:5.5.0-alpha.11 version: file:packages/tracking(@babel/core@7.23.2)(ember-source@5.3.0) - '@ember-data/unpublished-test-infra': - specifier: workspace:5.5.0-alpha.11 - version: file:packages/unpublished-test-infra(@babel/core@7.23.2)(qunit@2.19.4) '@ember/optional-features': specifier: ^2.0.0 version: 2.0.0 @@ -2271,6 +2268,9 @@ importers: '@types/ember__owner': specifier: ^4.0.6 version: 4.0.6 + '@warp-drive/diagnostic': + specifier: workspace:5.5.0-alpha.11 + version: file:packages/diagnostic ember-auto-import: specifier: ^2.6.3 version: 2.6.3(webpack@5.89.0) @@ -2289,6 +2289,9 @@ importers: ember-cli-inject-live-reload: specifier: ^2.1.0 version: 2.1.0 + ember-cli-test-loader: + specifier: ^3.1.0 + version: 3.1.0(@babel/core@7.23.2) ember-inflector: specifier: ^4.0.2 version: 4.0.2(@babel/core@7.23.2) @@ -2298,9 +2301,6 @@ importers: ember-maybe-import-regenerator: specifier: ^1.0.0 version: 1.0.0(@babel/core@7.23.2) - ember-qunit: - specifier: ^8.0.1 - version: 8.0.1(@babel/core@7.23.2)(@ember/test-helpers@3.2.0)(ember-source@5.3.0)(qunit@2.19.4) ember-resolver: specifier: ^11.0.1 version: 11.0.1(@babel/core@7.23.2)(ember-source@5.3.0) @@ -2310,12 +2310,6 @@ importers: loader.js: specifier: ^4.7.0 version: 4.7.0 - qunit: - specifier: 2.19.4 - version: 2.19.4(patch_hash=h2fz5inojlzu6daraxt5bghsqy) - qunit-dom: - specifier: ^3.0.0 - version: 3.0.0 webpack: specifier: ^5.89.0 version: 5.89.0 @@ -2330,7 +2324,7 @@ importers: injected: true '@ember-data/tracking': injected: true - '@ember-data/unpublished-test-infra': + '@warp-drive/diagnostic': injected: true tests/ember-data__request: diff --git a/tests/ember-data__model/.gitignore b/tests/ember-data__model/.gitignore deleted file mode 100644 index c40a1b2aba3..00000000000 --- a/tests/ember-data__model/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -# See https://help.github.com/ignore-files/ for more about ignoring files. - -# compiled output -/dist/ -/tmp/ - -# dependencies -/bower_components/ -/node_modules/ - -# misc -/.env* -/.pnp* -/.sass-cache -/connect.lock -/coverage/ -/libpeerconnection.log -/npm-debug.log* -/testem.log -/yarn-error.log - -# ember-try -/.node_modules.ember-try/ -/bower.json.ember-try -/package.json.ember-try diff --git a/tests/ember-data__model/.template-lintrc.js b/tests/ember-data__model/.template-lintrc.js deleted file mode 100644 index f35f61c7b3a..00000000000 --- a/tests/ember-data__model/.template-lintrc.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -module.exports = { - extends: 'recommended', -}; diff --git a/tests/ember-data__model/.watchmanconfig b/tests/ember-data__model/.watchmanconfig deleted file mode 100644 index e7834e3e4f3..00000000000 --- a/tests/ember-data__model/.watchmanconfig +++ /dev/null @@ -1,3 +0,0 @@ -{ - "ignore_dirs": ["tmp", "dist"] -} diff --git a/tests/ember-data__model/app/components/.gitkeep b/tests/ember-data__model/app/components/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/ember-data__model/app/controllers/.gitkeep b/tests/ember-data__model/app/controllers/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/ember-data__model/app/helpers/.gitkeep b/tests/ember-data__model/app/helpers/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/ember-data__model/app/models/.gitkeep b/tests/ember-data__model/app/models/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/ember-data__model/app/routes/.gitkeep b/tests/ember-data__model/app/routes/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/ember-data__model/app/templates/components/.gitkeep b/tests/ember-data__model/app/templates/components/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/ember-data__model/diagnostic.js b/tests/ember-data__model/diagnostic.js new file mode 100644 index 00000000000..ede75dbb1ad --- /dev/null +++ b/tests/ember-data__model/diagnostic.js @@ -0,0 +1,3 @@ +import launch from '@warp-drive/diagnostic/server/default-setup.js'; + +await launch(); diff --git a/tests/ember-data__model/ember-cli-build.js b/tests/ember-data__model/ember-cli-build.js index f748d4fb69c..d51a1731ef4 100644 --- a/tests/ember-data__model/ember-cli-build.js +++ b/tests/ember-data__model/ember-cli-build.js @@ -21,12 +21,16 @@ module.exports = function (defaults) { emberData: { compatWith, }, + tests: true, // Add options here babel: { // this ensures that the same build-time code stripping that is done // for library packages is also done for our tests and dummy app plugins, }, + 'ember-cli-babel': { + enableTypeScriptTransform: true, + }, }); // Use `app.import` to add additional libraries to the generated @@ -41,6 +45,7 @@ module.exports = function (defaults) { // modules that you would like to import into your application // please specify an object with the list of modules as keys // along with the exports of each module as its value. + app.import('node_modules/@warp-drive/diagnostic/dist/styles/dom-reporter.css'); return app.toTree(); }; diff --git a/tests/ember-data__model/package.json b/tests/ember-data__model/package.json index 7f83434d8c7..1862a5b21ca 100644 --- a/tests/ember-data__model/package.json +++ b/tests/ember-data__model/package.json @@ -15,11 +15,9 @@ "test": "tests" }, "scripts": { - "build": "ember build", - "lint:hbs": "ember-template-lint .", - "lint:js": "eslint --config ../../.eslintrc.js --ignore-path ../../.eslintignore .", - "start": "ember serve", - "test": "ember test --test-port=0" + "build": "ember build --output-path=dist-test --suppress-sizes", + "test": "pnpm build && bun ./diagnostic.js", + "test:production": "pnpm build -e production; bun ./diagnostic.js" }, "dependenciesMeta": { "@ember-data/adapter": { @@ -37,7 +35,7 @@ "@ember-data/tracking": { "injected": true }, - "@ember-data/unpublished-test-infra": { + "@warp-drive/diagnostic": { "injected": true } }, @@ -49,7 +47,7 @@ "@ember-data/serializer": "workspace:5.5.0-alpha.11", "@ember-data/store": "workspace:5.5.0-alpha.11", "@ember-data/tracking": "workspace:5.5.0-alpha.11", - "@ember-data/unpublished-test-infra": "workspace:5.5.0-alpha.11", + "@warp-drive/diagnostic": "workspace:5.5.0-alpha.11", "@ember/optional-features": "^2.0.0", "@ember/string": "3.1.1", "@ember/test-helpers": "^3.2.0", @@ -62,15 +60,13 @@ "ember-cli-dependency-checker": "^3.3.2", "ember-cli-htmlbars": "^6.3.0", "ember-cli-inject-live-reload": "^2.1.0", + "ember-cli-test-loader": "^3.1.0", "ember-inflector": "^4.0.2", "ember-load-initializers": "^2.1.2", "ember-maybe-import-regenerator": "^1.0.0", - "ember-qunit": "^8.0.1", "ember-resolver": "^11.0.1", "ember-source": "~5.3.0", "loader.js": "^4.7.0", - "qunit": "^2.20.0", - "qunit-dom": "^3.0.0", "webpack": "^5.89.0" }, "engines": { diff --git a/tests/ember-data__model/public/robots.txt b/tests/ember-data__model/public/robots.txt deleted file mode 100644 index f5916452e5f..00000000000 --- a/tests/ember-data__model/public/robots.txt +++ /dev/null @@ -1,3 +0,0 @@ -# http://www.robotstxt.org -User-agent: * -Disallow: diff --git a/tests/ember-data__model/testem.js b/tests/ember-data__model/testem.js deleted file mode 100644 index 6284ee221b7..00000000000 --- a/tests/ember-data__model/testem.js +++ /dev/null @@ -1,24 +0,0 @@ -// eslint-disable-next-line node/no-unpublished-require -const customDotReporter = require('@ember-data/unpublished-test-infra/src/testem/custom-dot-reporter'); - -module.exports = { - test_page: 'tests/index.html?hidepassed&nocontainer', - disable_watching: true, - reporter: customDotReporter, - launch_in_ci: ['Chrome'], - launch_in_dev: ['Chrome'], - browser_start_timeout: 120, - browser_args: { - Chrome: { - ci: [ - '--headless', - '--disable-dev-shm-usage', - '--disable-software-rasterizer', - '--mute-audio', - '--remote-debugging-port=0', - '--window-size=1440,900', - '--no-sandbox', - ], - }, - }, -}; diff --git a/tests/ember-data__model/tests/helpers/.gitkeep b/tests/ember-data__model/tests/helpers/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/ember-data__model/tests/index.html b/tests/ember-data__model/tests/index.html index 1b115759689..d5e2fc68a64 100644 --- a/tests/ember-data__model/tests/index.html +++ b/tests/ember-data__model/tests/index.html @@ -3,7 +3,7 @@ - EncapsulationTestApp Tests + @ember-data/model Tests @@ -12,7 +12,6 @@ - {{content-for "head-footer"}} {{content-for "test-head-footer"}} @@ -21,14 +20,12 @@ {{content-for "body"}} {{content-for "test-body"}} -
-
-
-
-
+ +
+
+
- diff --git a/tests/ember-data__model/tests/integration/.gitkeep b/tests/ember-data__model/tests/integration/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/ember-data__model/tests/integration/model-for-test.js b/tests/ember-data__model/tests/integration/model-for-test.ts similarity index 54% rename from tests/ember-data__model/tests/integration/model-for-test.js rename to tests/ember-data__model/tests/integration/model-for-test.ts index a9a38f9f9ac..a47cb07d40a 100644 --- a/tests/ember-data__model/tests/integration/model-for-test.js +++ b/tests/ember-data__model/tests/integration/model-for-test.ts @@ -1,34 +1,30 @@ -import { module, test } from 'qunit'; - -import { setupTest } from 'ember-qunit'; +import { module, test } from '@warp-drive/diagnostic'; import Store from '@ember-data/store'; -module('modelFor without @ember-data/model', function (hooks) { - setupTest(hooks); - +module('modelFor without @ember-data/model', function () { test('We can call modelFor', function (assert) { - this.owner.register( - 'service:store', - class TestStore extends Store { - instantiateRecord() { - return { - id: '1', - type: 'user', - name: 'Chris Thoburn', - }; - } - teardownRecord() { - return; - } + class TestStore extends Store { + instantiateRecord() { + return { + id: '1', + type: 'user', + name: 'Chris Thoburn', + }; + } + teardownRecord() { + return; } - ); - const store = this.owner.lookup('service:store'); - store.registerSchemaDefinitionService({ + } + const store = new TestStore(); + + store.registerSchema({ attributesDefinitionFor(identifier) { return { name: { name: 'name', + kind: 'attribute', + type: null, }, }; }, @@ -44,15 +40,15 @@ module('modelFor without @ember-data/model', function (hooks) { store.modelFor('user'); assert.ok(true, 'We should not throw an eror when schema is available'); } catch (e) { - assert.ok(false, `We threw an unexpected error when schema is available: ${e.message}`); + assert.ok(false, `We threw an unexpected error when schema is available: ${(e as Error).message}`); } try { store.modelFor('person'); assert.ok(false, 'We should throw an eror when no schema is available'); } catch (e) { - assert.strictEqual( - e.message, + assert.equal( + (e as Error).message, "Assertion Failed: No model was found for 'person' and no schema handles the type", 'We throw an error when no schema is available' ); @@ -60,27 +56,26 @@ module('modelFor without @ember-data/model', function (hooks) { }); test('modelFor returns a stable reference', function (assert) { - this.owner.register( - 'service:store', - class TestStore extends Store { - instantiateRecord() { - return { - id: '1', - type: 'user', - name: 'Chris Thoburn', - }; - } - teardownRecord() { - return; - } + class TestStore extends Store { + instantiateRecord() { + return { + id: '1', + type: 'user', + name: 'Chris Thoburn', + }; } - ); - const store = this.owner.lookup('service:store'); - store.registerSchemaDefinitionService({ + teardownRecord() { + return; + } + } + const store = new TestStore(); + store.registerSchema({ attributesDefinitionFor(identifier) { return { name: { name: 'name', + kind: 'attribute', + type: null, }, }; }, @@ -94,6 +89,6 @@ module('modelFor without @ember-data/model', function (hooks) { const ShimUser1 = store.modelFor('user'); const ShimUser2 = store.modelFor('user'); - assert.strictEqual(ShimUser1, ShimUser2, 'Repeat modelFor calls return the same shim'); + assert.equal(ShimUser1, ShimUser2, 'Repeat modelFor calls return the same shim'); }); }); diff --git a/tests/ember-data__model/tests/test-helper.js b/tests/ember-data__model/tests/test-helper.js index bffc9f847f4..4e482ada2cc 100644 --- a/tests/ember-data__model/tests/test-helper.js +++ b/tests/ember-data__model/tests/test-helper.js @@ -1,19 +1,52 @@ -import { setApplication } from '@ember/test-helpers'; +import { setupGlobalHooks } from '@warp-drive/diagnostic'; +import { start } from '@warp-drive/diagnostic/runners/dom'; -import * as QUnit from 'qunit'; -import { setup } from 'qunit-dom'; +import AbstractTestLoader from 'ember-cli-test-loader/test-support/index'; -import { start } from 'ember-qunit'; +let moduleLoadFailures = []; +setupGlobalHooks((hooks) => { + hooks.onSuiteFinish(() => { + let length = moduleLoadFailures.length; -import configureAsserts from '@ember-data/unpublished-test-infra/test-support/asserts'; + try { + if (length === 0) { + // do nothing + } else if (length === 1) { + throw moduleLoadFailures[0]; + } else { + throw new Error('\n' + moduleLoadFailures.join('\n')); + } + } finally { + // ensure we release previously captured errors. + moduleLoadFailures = []; + } + }); +}); -import Application from '../app'; -import config from '../config/environment'; +export class TestLoader extends AbstractTestLoader { + moduleLoadFailure(moduleName, error) { + moduleLoadFailures.push(error); + } +} -setup(QUnit.assert); -configureAsserts(QUnit.hooks); +/** + Load tests following the default patterns: -setApplication(Application.create(config.APP)); + * The module name ends with `-test` + * The module name ends with `.jshint` -QUnit.config.testTimeout = 2000; -start({ setupTestIsolationValidation: true }); + @method loadTests + */ +export function loadTests() { + new TestLoader().loadModules(); +} + +loadTests(); + +start({ + tryCatch: false, + groupLogs: false, + instrument: true, + hideReport: true, + useDiagnostic: true, +}); diff --git a/tests/ember-data__model/tests/unit/.gitkeep b/tests/ember-data__model/tests/unit/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/ember-data__model/vendor/.gitkeep b/tests/ember-data__model/vendor/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/ember-data__request/testem.js b/tests/ember-data__request/testem.js deleted file mode 100644 index 1d9ffdebfd0..00000000000 --- a/tests/ember-data__request/testem.js +++ /dev/null @@ -1,7 +0,0 @@ -/* eslint-disable node/no-unpublished-require */ -const TestemConfig = require('@ember-data/unpublished-test-infra/src/testem/testem'); - -const Config = Object.assign({}, TestemConfig); -Config.framework = 'custom'; - -module.exports = Config;