Skip to content

Commit

Permalink
Move rest of tests (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
samselikoff committed Jul 29, 2019
1 parent c58a33b commit 80c3808
Show file tree
Hide file tree
Showing 193 changed files with 5,605 additions and 35,861 deletions.
4 changes: 0 additions & 4 deletions .bowerrc

This file was deleted.

20 changes: 0 additions & 20 deletions .editorconfig

This file was deleted.

9 changes: 0 additions & 9 deletions .ember-cli

This file was deleted.

12 changes: 0 additions & 12 deletions .eslintignore
@@ -1,18 +1,6 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/

# misc
/coverage/

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
12 changes: 0 additions & 12 deletions .gitignore
Expand Up @@ -5,7 +5,6 @@
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
Expand All @@ -14,19 +13,8 @@
/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

# custom
.floo
_site
jekyll-tmp

# IDE
/.idea/
/*.iml
20 changes: 1 addition & 19 deletions .npmignore
Expand Up @@ -2,38 +2,20 @@
/dist/
/tmp/

# dependencies
/bower_components/

# misc
/.bowerrc
/.editorconfig
/.ember-cli
/.eslintignore
/.eslintrc.js
/.gitignore
/.watchmanconfig
/.travis.yml
/bower.json
/config/ember-try.js
/dist
/scripts
/tmp
**/.gitkeep
bower.json
/ember-cli-build.js
/testem.js
/__tests__/
/tests/
/yarn.lock
.gitkeep

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try

/.sass-cache
/jekyll-tmp
*.md

/test-projects
8 changes: 0 additions & 8 deletions .template-lintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions CHANGELOG.md
@@ -1,3 +1,3 @@
# Ember CLI Mirage Change log
# Mirage Change log

Releases (along with upgrade instructions) are documented on the Github [Releases](https://github.com/samselikoff/ember-cli-mirage/releases) page.
Releases (along with upgrade instructions) are documented on the Github [Releases](https://github.com/miragejs/server/releases) page.
38 changes: 0 additions & 38 deletions CONTRIBUTING.md

This file was deleted.

17 changes: 0 additions & 17 deletions ISSUE_TEMPLATE.md

This file was deleted.

Expand Up @@ -3,17 +3,18 @@ import {
Model,
hasMany,
belongsTo
} from "ember-cli-mirage";
import Schema from "ember-cli-mirage/orm/schema";
import Db from "ember-cli-mirage/db";
import SerializerRegistry from "ember-cli-mirage/serializer-registry";
import { module, test } from "qunit";
} from "@miragejs/server";
import Schema from "@lib/orm/schema";
import Db from "@lib/db";
import SerializerRegistry from "@lib/serializer-registry";

module("Integration | Serializer | ActiveModelSerializer", function(hooks) {
hooks.beforeEach(function() {
describe("Integration | Serializer | ActiveModelSerializer", () => {
let schema, registry;

beforeEach(function() {
let db = new Db();
this.schema = new Schema(db);
this.schema.registerModels({
schema = new Schema(db);
schema.registerModels({
wordSmith: Model.extend({
blogPosts: hasMany()
}),
Expand All @@ -32,20 +33,20 @@ module("Integration | Serializer | ActiveModelSerializer", function(hooks) {
})
});

let link = this.schema.wordSmiths.create({ name: "Link", age: 123 });
let link = schema.wordSmiths.create({ name: "Link", age: 123 });
let post1 = link.createBlogPost({ title: "Lorem" });
link.createBlogPost({ title: "Ipsum" });

this.schema.wordSmiths.create({ name: "Zelda", age: 230 });
schema.wordSmiths.create({ name: "Zelda", age: 230 });

let user = this.schema.users.create({ name: "John Peach", age: 123 });
let user = schema.users.create({ name: "John Peach", age: 123 });
user.createContactInfo({ email: "peach@bb.me" });
user.createContactInfo({ email: "john3000@mail.com" });

this.schema.users.create({ name: "Pine Apple", age: 230 });
this.schema.comments.create({ text: "Hi there", commentable: post1 });
schema.users.create({ name: "Pine Apple", age: 230 });
schema.comments.create({ text: "Hi there", commentable: post1 });

this.registry = new SerializerRegistry(this.schema, {
registry = new SerializerRegistry(schema, {
application: ActiveModelSerializer,
wordSmith: ActiveModelSerializer.extend({
serializeIds: "included",
Expand Down Expand Up @@ -73,15 +74,15 @@ module("Integration | Serializer | ActiveModelSerializer", function(hooks) {
});
});

hooks.afterEach(function() {
this.schema.db.emptyData();
afterEach(function() {
schema.db.emptyData();
});

test("it sideloads associations and snake-cases relationships and attributes correctly for a model", function(assert) {
let link = this.schema.wordSmiths.find(1);
let result = this.registry.serialize(link);
test("it sideloads associations and snake-cases relationships and attributes correctly for a model", () => {
let link = schema.wordSmiths.find(1);
let result = registry.serialize(link);

assert.deepEqual(result, {
expect(result).toEqual({
word_smith: {
id: "1",
name: "Link",
Expand Down Expand Up @@ -112,11 +113,11 @@ module("Integration | Serializer | ActiveModelSerializer", function(hooks) {
});
});

test("it sideloads associations and snake-cases relationships and attributes correctly for a collection", function(assert) {
let wordSmiths = this.schema.wordSmiths.all();
let result = this.registry.serialize(wordSmiths);
test("it sideloads associations and snake-cases relationships and attributes correctly for a collection", () => {
let wordSmiths = schema.wordSmiths.all();
let result = registry.serialize(wordSmiths);

assert.deepEqual(result, {
expect(result).toEqual({
word_smiths: [
{
id: "1",
Expand Down Expand Up @@ -154,11 +155,11 @@ module("Integration | Serializer | ActiveModelSerializer", function(hooks) {
});
});

test("it embeds associations and snake-cases relationships and attributes correctly for a collection", function(assert) {
let users = this.schema.users.all();
let result = this.registry.serialize(users);
test("it embeds associations and snake-cases relationships and attributes correctly for a collection", () => {
let users = schema.users.all();
let result = registry.serialize(users);

assert.deepEqual(result, {
expect(result).toEqual({
users: [
{
id: "1",
Expand Down

0 comments on commit 80c3808

Please sign in to comment.