Skip to content

Instantly share code, notes, and snippets.

{
"settings": {
"analysis": {
"analyzer": {
"my_email_analyzer": {
"type": "custom",
"tokenizer": "uax_url_email",
"filter": ["lowercase", "stop"]
}
}
"properties": {
"content": {
"type": "string",
+ "search_analyzer": "my_email_analyzer",
"fields": {
"my_field": {
"type": "string",
"properties": {
"content": {
"type": "string",
- "analyzer": "my_email_analyzer"
+ "fields": {
+ "custom": {
+ "type": "string",
+ "analyzer": "my_email_analyzer"
+ }
+ }
{
"settings": {
"analysis": {
"analyzer": {
"my_email_analyzer": {
"type": "custom",
"tokenizer": "uax_url_email",
"filter": ["lowercase", "stop"]
}
}
describe('The userDisplay component', function() {
it('should display the basic user information', function() {
var user = {
name: 'Bob',
job: 'Pianist'
};
var element = compileComponent('<user-display user="user"></user-display>', user);
expect(element.find('p')[0].html()).to.contain(user.name);
expect(element.find('p')[1].html()).to.contain(user.job);
describe('The toggleFollow function', function() {
it('should unfollow the followed user', function() {
// mock
followService.isFollowing = function() {
return true;
};
var controller = initController();
controller.toggleFollow();
.controller('userDisplayController', function(followService) {
var self = this;
self.toggleFollow = toggleFollow;
self.isFollowing = followService.isFollowing(self.user);
function toggleFollow() {
if (isFollowing) {
followService.unfollow(self.user);
self.isFollowing = false;
<div>
<p>Name: {{$ctrl.user.name}}</p>
<p>Job: {{$ctrl.user.job}}</p>
<button ng-click="$ctrl.toggleFollow()">
<span ng-if="{{!$ctrl.isFollowing}}">Follow</span>
<span ng-if="{{$ctrl.isFollowing}}">Unfollow</span>
</button>
</div>
.component('userDisplay', {
templateUrl: 'user-display.html',
bindings: {
user: '<'
},
controller: 'userDisplayController'
})

Everytime you run grunt docker-test-midway-backend, it will spawn containers, run midway tests then remove containers. It would take time if you run that command multiple times. In fact, you just have to spawn containers once, run the tests multiple times then remove the containers when you finish.

Spawn the containers (AKA prepare the testing environment):

grunt setup-environment setup-mongo-es-docker

Run the midway tests: