Skip to content

Commit

Permalink
Fix tests to not use "Astro."
Browse files Browse the repository at this point in the history
  • Loading branch information
lukejagodzinski committed Oct 6, 2017
1 parent 083d560 commit 28d3bdb
Show file tree
Hide file tree
Showing 19 changed files with 83 additions and 50 deletions.
7 changes: 4 additions & 3 deletions test/behaviors/behaviors_slug.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Class } from 'meteor/jagi:astronomy';
import _contains from 'lodash/contains';

Tinytest.add('Behaviors - Slug', function(test) {
// Reset Astro.
// Reset Astronomy.
reset();

var SlugsA = new Mongo.Collection(null);
Expand All @@ -19,7 +20,7 @@ Tinytest.add('Behaviors - Slug', function(test) {
SlugsB.remove(slug._id);
});

var SlugA = Astro.Class.create({
var SlugA = Class.create({
name: 'SlugA',
collection: SlugsA,
fields: {
Expand All @@ -30,7 +31,7 @@ Tinytest.add('Behaviors - Slug', function(test) {
}
});

var SlugB = Astro.Class.create({
var SlugB = Class.create({
name: 'SlugB',
collection: SlugsB,
fields: {
Expand Down
10 changes: 6 additions & 4 deletions test/behaviors/behaviors_softremove.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Class } from 'meteor/jagi:astronomy';

Tinytest.add('Behaviors - Softremove', function(test) {
// Reset Astro.
// Reset Astronomy.
reset();

SoftremovesA = new Mongo.Collection(null);
Expand All @@ -24,7 +26,7 @@ Tinytest.add('Behaviors - Softremove', function(test) {
SoftremovesC.remove(item._id);
});

var SoftremoveA = Astro.Class.create({
var SoftremoveA = Class.create({
name: 'SoftremoveA',
collection: SoftremovesA,
fields: {
Expand All @@ -35,7 +37,7 @@ Tinytest.add('Behaviors - Softremove', function(test) {
}
});

var SoftremoveB = Astro.Class.create({
var SoftremoveB = Class.create({
name: 'SoftremoveB',
collection: SoftremovesB,
fields: {
Expand All @@ -50,7 +52,7 @@ Tinytest.add('Behaviors - Softremove', function(test) {
}
});

var SoftremoveC = Astro.Class.create({
var SoftremoveC = Class.create({
name: 'SoftremoveC',
collection: SoftremovesC,
fields: {
Expand Down
10 changes: 6 additions & 4 deletions test/behaviors/behaviors_timestamp.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Class } from 'meteor/jagi:astronomy';

Tinytest.addAsync('Behaviors - Timestamp', function(test, next) {
// Reset Astro.
// Reset Astronomy.
reset();

var TimestampsA = new Mongo.Collection(null);
Expand All @@ -24,7 +26,7 @@ Tinytest.addAsync('Behaviors - Timestamp', function(test, next) {
TimestampsC.remove(item._id);
});

var TimestampA = Astro.Class.create({
var TimestampA = Class.create({
name: 'TimestampA',
collection: TimestampsA,
fields: {
Expand All @@ -35,7 +37,7 @@ Tinytest.addAsync('Behaviors - Timestamp', function(test, next) {
}
});

var TimestampB = Astro.Class.create({
var TimestampB = Class.create({
name: 'TimestampB',
collection: TimestampsB,
fields: {
Expand All @@ -49,7 +51,7 @@ Tinytest.addAsync('Behaviors - Timestamp', function(test, next) {
}
});

var TimestampC = Astro.Class.create({
var TimestampC = Class.create({
name: 'TimestampC',
collection: TimestampsC,
fields: {
Expand Down
6 changes: 4 additions & 2 deletions test/core/ejson.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Class } from 'meteor/jagi:astronomy';

Tinytest.add('Core - EJSON', function(test) {
reset();

let NestedEJSON = Astro.Class.create({
let NestedEJSON = Class.create({
name: 'NestedEJSON',
fields: {
string: {
Expand All @@ -13,7 +15,7 @@ Tinytest.add('Core - EJSON', function(test) {
}
});

let ClassEJSON = Astro.Class.create({
let ClassEJSON = Class.create({
name: 'ClassEJSON',
fields: {
one: {
Expand Down
8 changes: 5 additions & 3 deletions test/core/extend.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Class, Field } from 'meteor/jagi:astronomy';

Tinytest.add('Core - Extend', function(test) {
reset();

const Extended = Astro.Class.create({
const Extended = Class.create({
name: 'Extended',
fields: {
originalField: {
Expand Down Expand Up @@ -31,10 +33,10 @@ Tinytest.add('Core - Extend', function(test) {
});

// Fields.
test.instanceOf(Extended.getField('originalField'), Astro.Field,
test.instanceOf(Extended.getField('originalField'), Field,
'Class should contain original fields'
);
test.instanceOf(Extended.getField('extendField'), Astro.Field,
test.instanceOf(Extended.getField('extendField'), Field,
'Class should contain extended fields'
);

Expand Down
6 changes: 3 additions & 3 deletions test/core/inherit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Class } from 'meteor/jagi:astronomy';
import { Class, Field } from 'meteor/jagi:astronomy';

Tinytest.add('Core - Inherit', function(test) {
reset();
Expand Down Expand Up @@ -34,10 +34,10 @@ Tinytest.add('Core - Inherit', function(test) {
});

// Fields.
test.instanceOf(Child.getField('parentField'), Astro.Field,
test.instanceOf(Child.getField('parentField'), Field,
'The child class should inherit parent fields'
);
test.instanceOf(Child.getField('childField'), Astro.Field,
test.instanceOf(Child.getField('childField'), Field,
'The child class should have its own fields'
);

Expand Down
4 changes: 3 additions & 1 deletion test/core/state.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Class } from 'meteor/jagi:astronomy';

Tinytest.add('Core - State', function(test) {
reset();

const States = new Mongo.Collection(null);

const State = Astro.Class.create({
const State = Class.create({
name: 'State',
collection: States
});
Expand Down
14 changes: 8 additions & 6 deletions test/modules/behaviors/apply.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { Class, Field } from 'meteor/jagi:astronomy';

Tinytest.add('Modules - Behaviors - Apply', function(test) {
let ClassBehavior1 = Astro.Class.create({
let ClassBehavior1 = Class.create({
name: 'ClassBehavior1',
behaviors: ['custom']
});

let ClassBehavior2 = Astro.Class.create({
let ClassBehavior2 = Class.create({
name: 'ClassBehavior2',
behaviors: {
custom: {}
}
});

let ClassBehavior3 = Astro.Class.create({
let ClassBehavior3 = Class.create({
name: 'ClassBehavior3',
behaviors: {
custom: {
Expand All @@ -21,17 +23,17 @@ Tinytest.add('Modules - Behaviors - Apply', function(test) {
});

test.instanceOf(
ClassBehavior1.getField('behaviorField'), Astro.Field,
ClassBehavior1.getField('behaviorField'), Field,
'Behaviors list as an array of strings not applied'
);

test.instanceOf(
ClassBehavior2.getField('behaviorField'), Astro.Field,
ClassBehavior2.getField('behaviorField'), Field,
'Behavior list as an object of options not applied'
);

test.instanceOf(
ClassBehavior3.getField('anotherField'), Astro.Field,
ClassBehavior3.getField('anotherField'), Field,
'Behavior list as an object of options with custom option not applied'
);
});
6 changes: 4 additions & 2 deletions test/modules/behaviors/create.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Behavior } from 'meteor/jagi:astronomy';

Tinytest.add('Modules - Behaviors - Create', function(test) {
reset();

let CustomBehavior = Astro.Behavior.create({
let CustomBehavior = Behavior.create({
name: 'custom',
options: {
fieldName: 'behaviorField'
Expand All @@ -23,7 +25,7 @@ Tinytest.add('Modules - Behaviors - Create', function(test) {
});

test.isTrue(
Astro.Behavior.prototype.isPrototypeOf(CustomBehavior.prototype),
Behavior.prototype.isPrototypeOf(CustomBehavior.prototype),
'Behavior not created'
);
});
6 changes: 4 additions & 2 deletions test/modules/events/cancelable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Class } from 'meteor/jagi:astronomy';

Tinytest.add('Modules - Events - Cancelable', function(test) {
let CancelableNestedEvent = Astro.Class.create({
let CancelableNestedEvent = Class.create({
name: 'CancelableNestedEvent',
events: {
beforeSave: function(e) {
Expand All @@ -13,7 +15,7 @@ Tinytest.add('Modules - Events - Cancelable', function(test) {

let CancelableEvents = new Mongo.Collection(null);

let CancelableEvent = Astro.Class.create({
let CancelableEvent = Class.create({
name: 'CancelableEvent',
collection: CancelableEvents,
fields: {
Expand Down
6 changes: 4 additions & 2 deletions test/modules/events/order.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Class } from 'meteor/jagi:astronomy';

Tinytest.add('Modules - Events - Order', function(test) {
let executedEvents = [];
let expectedEvents = [];

let OrderNestedEvent = Astro.Class.create({
let OrderNestedEvent = Class.create({
name: 'OrderNestedEvent',
events: {
beforeInit: function(e) {
Expand Down Expand Up @@ -34,7 +36,7 @@ Tinytest.add('Modules - Events - Order', function(test) {

let OrderEvents = new Mongo.Collection(null);

let OrderEvent = Astro.Class.create({
let OrderEvent = Class.create({
name: 'OrderEvent',
collection: OrderEvents,
fields: {
Expand Down
8 changes: 5 additions & 3 deletions test/modules/events/propagation.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { Class } from 'meteor/jagi:astronomy';

Tinytest.add('Modules - Events - Propagation', function(test) {
// Reset Astro.
// Reset Astronomy.
reset();

let expectedEvents = [];
let executedEvents = [];

let PropagationNestedEvent = Astro.Class.create({
let PropagationNestedEvent = Class.create({
name: 'PropagationNestedEvent',
events: {
beforeSave: [
Expand All @@ -18,7 +20,7 @@ Tinytest.add('Modules - Events - Propagation', function(test) {

let PropagationEvents = new Mongo.Collection(null);

let PropagationEvent = Astro.Class.create({
let PropagationEvent = Class.create({
name: 'PropagationEvent',
collection: PropagationEvents,
fields: {
Expand Down
4 changes: 3 additions & 1 deletion test/modules/fields/definition.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Class } from 'meteor/jagi:astronomy';

Tinytest.add('Modules - Fields - Definition', function(test) {
reset();

let Definition = Astro.Class.create({
let Definition = Class.create({
name: 'Definition',
fields: {
// Field type provided.
Expand Down
6 changes: 4 additions & 2 deletions test/modules/fields/set.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Class } from 'meteor/jagi:astronomy';

Tinytest.add('Modules - Fields - Set', function(test) {
reset();

let SetClassNested = Astro.Class.create({
let SetClassNested = Class.create({
name: 'SetClassNested',
fields: {
string: {
Expand All @@ -11,7 +13,7 @@ Tinytest.add('Modules - Fields - Set', function(test) {
});

// Define simple class to work with.
let SetClass = Astro.Class.create({
let SetClass = Class.create({
name: 'SetClass',
fields: {
one: {
Expand Down
6 changes: 4 additions & 2 deletions test/modules/helpers/definition.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Class } from 'meteor/jagi:astronomy';

Tinytest.add('Modules - Helpers - Definition', function(test) {
// Reset Astro.
// Reset Astronomy.
reset();

const Helper = Astro.Class.create({
const Helper = Class.create({
name: 'Helper',
helpers: {
helperA() {
Expand Down
6 changes: 4 additions & 2 deletions test/modules/indexes/indexes_definition.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Class } from 'meteor/jagi:astronomy';

Tinytest.add('Indexes - Add', function(test) {
// Reset Astro.
// Reset Astronomy.
reset();

var Future = Npm.require('fibers/future');
Expand Down Expand Up @@ -27,7 +29,7 @@ Tinytest.add('Indexes - Add', function(test) {
Indexes._dropIndex('indexes');
} catch (e) {}

var Index = Astro.Class.create({
var Index = Class.create({
name: 'Index',
collection: Indexes,
fields: {
Expand Down
4 changes: 3 additions & 1 deletion test/modules/validators/apply.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Class } from 'meteor/jagi:astronomy';

Tinytest.add('Modules - Validators - Apply', function(test) {
const validators = [{
type: 'custom',
param: 'abc'
}];

let ClassValidator = Astro.Class.create({
let ClassValidator = Class.create({
name: 'ClassValidator',
fields: {
name: {
Expand Down
Loading

0 comments on commit 28d3bdb

Please sign in to comment.