Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update jest to v21.2.1 #242

Merged
merged 2 commits into from
Mar 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"eslint": "^3.15.0",
"eslint-config-airbnb-base": "^11.1.0",
"eslint-plugin-import": "^2.2.0",
"jest": "^20.0.4",
"jest": "^21.0.0",
"lerna-changelog": "^0.7.0"
},
"dependencies": {
Expand Down
205 changes: 89 additions & 116 deletions tests/lib/utils/ember-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,17 @@ describe('isDSModel', () => {
expect(emberUtils.isDSModel(node)).toBeTruthy();
});

it('should check if it\'s a DS Model even if it uses custom name', () => {
const node = parse('CustomModel.extend()');
const filePath = 'example-app/models/path/to/some-model.js';

expect(
emberUtils.isDSModel(node),
'it shouldn\'t detect Model when no file path is provided'
).toBeFalsy();
describe('should check if it\'s a DS Model even if it uses custom name', () => {
it('it shouldn\'t detect Model when no file path is provided', () => {
const node = parse('CustomModel.extend()');
expect(emberUtils.isDSModel(node)).toBeFalsy();
});

expect(
emberUtils.isDSModel(node, filePath),
'it should detect Model when file path is provided'
).toBeTruthy();
it('it should detect Model when file path is provided', () => {
const node = parse('CustomModel.extend()');
const filePath = 'example-app/models/path/to/some-model.js';
expect(emberUtils.isDSModel(node, filePath)).toBeTruthy();
});
});
});

Expand Down Expand Up @@ -123,135 +121,110 @@ describe('isEmberCoreModule', () => {
});

describe('isEmberComponent', () => {
it('should check if it\'s an Ember Component', () => {
let node;

node = parse('Ember.Component.extend()');
expect(
emberUtils.isEmberComponent(node),
'it should detect Component when using Ember.Component'
).toBeTruthy();
describe('should check if it\'s an Ember Component', () => {
it('it should detect Component when using Ember.Component', () => {
const node = parse('Ember.Component.extend()');
expect(emberUtils.isEmberComponent(node)).toBeTruthy();
});

node = parse('Component.extend()');
expect(
emberUtils.isEmberComponent(node),
'it should detect Component when using local module Component'
).toBeTruthy();
it('it should detect Component when using local module Component', () => {
const node = parse('Component.extend()');
expect(emberUtils.isEmberComponent(node)).toBeTruthy();
});
});

it('should check if it\'s an Ember Component even if it uses custom name', () => {
const node = parse('CustomComponent.extend()');
const filePath = 'example-app/components/path/to/some-component.js';

expect(
emberUtils.isEmberComponent(node),
'it shouldn\'t detect Component when no file path is provided'
).toBeFalsy();
describe('should check if it\'s an Ember Component even if it uses custom name', () => {
it('it shouldn\'t detect Component when no file path is provided', () => {
const node = parse('CustomComponent.extend()');
expect(emberUtils.isEmberComponent(node)).toBeFalsy();
});

expect(
emberUtils.isEmberComponent(node, filePath),
'it should detect Component when file path is provided'
).toBeTruthy();
it('it should detect Component when file path is provided', () => {
const node = parse('CustomComponent.extend()');
const filePath = 'example-app/components/path/to/some-component.js';
expect(emberUtils.isEmberComponent(node, filePath)).toBeTruthy();
});
});
});

describe('isEmberController', () => {
it('should check if it\'s an Ember Controller', () => {
let node;

node = parse('Ember.Controller.extend()');
expect(
emberUtils.isEmberController(node),
'it should detect Controller when using Ember.Controller'
).toBeTruthy();
describe('should check if it\'s an Ember Controller', () => {
it('it should detect Controller when using Ember.Controller', () => {
const node = parse('Ember.Controller.extend()');
expect(emberUtils.isEmberController(node)).toBeTruthy();
});

node = parse('Controller.extend()');
expect(
emberUtils.isEmberController(node),
'it should detect Controller when using local module Controller'
).toBeTruthy();
it('it should detect Controller when using local module Controller', () => {
const node = parse('Controller.extend()');
expect(emberUtils.isEmberController(node)).toBeTruthy();
});
});

it(
'should check if it\'s an Ember Controller even if it uses custom name', () => {
describe('should check if it\'s an Ember Controller even if it uses custom name', () => {
it('it shouldn\'t detect Controller when no file path is provided', () => {
const node = parse('CustomController.extend()');
const filePath = 'example-app/controllers/path/to/some-feature.js';

expect(
emberUtils.isEmberController(node),
'it shouldn\'t detect Controller when no file path is provided'
).toBeFalsy();
expect(emberUtils.isEmberController(node)).toBeFalsy();
});

expect(
emberUtils.isEmberController(node, filePath),
'it should detect Controller when file path is provided'
).toBeTruthy();
it('it should detect Controller when file path is provided', () => {
const node = parse('CustomController.extend()');
const filePath = 'example-app/controllers/path/to/some-feature.js';
expect(emberUtils.isEmberController(node, filePath)).toBeTruthy();
});
});
});

describe('isEmberRoute', () => {
it('should check if it\'s an Ember Route', () => {
let node;

node = parse('Ember.Route.extend()');
expect(
emberUtils.isEmberRoute(node),
'it should detect Route when using Ember.Route'
).toBeTruthy();
describe('should check if it\'s an Ember Route', () => {
it('should detect Route when using Ember.Route', () => {
const node = parse('Ember.Route.extend()');
expect(emberUtils.isEmberRoute(node)).toBeTruthy();
});

node = parse('Route.extend()');
expect(
emberUtils.isEmberRoute(node),
'it should detect Route when using local module Route'
).toBeTruthy();
it('should detect Route when using local module Route', () => {
const node = parse('Route.extend()');
expect(emberUtils.isEmberRoute(node)).toBeTruthy();
});
});

it('should check if it\'s an Ember Route even if it uses custom name', () => {
const node = parse('CustomRoute.extend()');
const filePath = 'example-app/routes/path/to/some-feature.js';

expect(
emberUtils.isEmberRoute(node),
'it shouldn\'t detect Route when no file path is provided'
).toBeFalsy();
describe('should check if it\'s an Ember Route even if it uses custom name', () => {
it('it shouldn\'t detect Route when no file path is provided', () => {
const node = parse('CustomRoute.extend()');
expect(emberUtils.isEmberRoute(node)).toBeFalsy();
});

expect(
emberUtils.isEmberRoute(node, filePath),
'it should detect Route when file path is provided'
).toBeTruthy();
it('it should detect Route when file path is provided', () => {
const node = parse('CustomRoute.extend()');
const filePath = 'example-app/routes/path/to/some-feature.js';
expect(emberUtils.isEmberRoute(node, filePath)).toBeTruthy();
});
});
});

describe('isEmberService', () => {
it('should check if it\'s an Ember Service', () => {
let node;

node = parse('Ember.Service.extend()');
expect(
emberUtils.isEmberService(node),
'it should detect Service when using Ember.Service'
).toBeTruthy();

node = parse('Service.extend()');
expect(
emberUtils.isEmberService(node),
'it should detect Service when using local module Service'
).toBeTruthy();
});

it('should check if it\'s an Ember Service even if it uses custom name', () => {
const node = parse('CustomService.extend()');
const filePath = 'example-app/services/path/to/some-feature.js';

expect(
emberUtils.isEmberService(node),
'it shouldn\'t detect Service when no file path is proviced'
).toBeFalsy();

expect(
emberUtils.isEmberService(node, filePath),
'it should detect Service when file path is provided'
).toBeTruthy();
describe('should check if it\'s an Ember Service', () => {
it('should detect Service when using Ember.Service', () => {
const node = parse('Ember.Service.extend()');
expect(emberUtils.isEmberService(node)).toBeTruthy();
});

it('should detect Service when using local module Service', () => {
const node = parse('Service.extend()');
expect(emberUtils.isEmberService(node)).toBeTruthy();
});
});

describe('should check if it\'s an Ember Service even if it uses custom name', () => {
it('shouldn\'t detect Service when no file path is provided', () => {
const node = parse('CustomService.extend()');
expect(emberUtils.isEmberService(node)).toBeFalsy();
});

it('it should detect Service when file path is provided', () => {
const node = parse('CustomService.extend()');
const filePath = 'example-app/services/path/to/some-feature.js';
expect(emberUtils.isEmberService(node, filePath)).toBeTruthy();
});
});
});

Expand Down