1- import { assert } from 'chai ' ;
2- import { it , describe } from 'mocha ' ;
1+ import { module , test } from 'qunit ' ;
2+ import { setupTest } from 'ember-qunit ' ;
33import { tokenize } from 'ember-search-with-modifiers/utils/search' ;
44
5- describe ( 'Unit | Utility | search' , function ( ) {
5+ module ( 'Unit | Utility | search' , function ( hooks ) {
6+ setupTest ( hooks ) ;
7+
68 function tokenizeAndDescribe ( text ) {
79 let config = {
810 '#' : {
@@ -24,56 +26,56 @@ describe('Unit | Utility | search', function() {
2426 } ) . join ( '' ) ;
2527 }
2628
27- describe ( 'tokenize' , function ( ) {
28- it ( 'treats words as spaces' , function ( ) {
29+ module ( 'tokenize' , function ( ) {
30+ test ( 'treats words as spaces' , function ( assert ) {
2931 assert . equal ( tokenizeAndDescribe ( 'hello' ) , 'hello(space)' ) ;
3032 } ) ;
3133
32- it ( 'splits words' , function ( ) {
34+ test ( 'splits words' , function ( assert ) {
3335 assert . equal ( tokenizeAndDescribe ( 'hello world' ) , 'hello(space) (space)world(space)' ) ;
3436 } ) ;
3537
36- it ( 'consolidates spaces' , function ( ) {
38+ test ( 'consolidates spaces' , function ( assert ) {
3739 assert . equal ( tokenizeAndDescribe ( 'hello world' ) , 'hello(space) (space)world(space)' ) ;
3840 } ) ;
3941
40- it ( 'keeps quoted phrases together' , function ( ) {
42+ test ( 'keeps quoted phrases together' , function ( assert ) {
4143 assert . equal ( tokenizeAndDescribe ( '"hello world"' ) , '"hello world"(space)' ) ;
4244 } ) ;
4345
44- it ( 'handles half-quoted phrases' , function ( ) {
46+ test ( 'handles half-quoted phrases' , function ( assert ) {
4547 assert . equal ( tokenizeAndDescribe ( '"hello' ) , '"hello(space)' ) ;
4648 } ) ;
4749
48- it ( 'identifies field-modifiers' , function ( ) {
50+ test ( 'identifies field-modifiers' , function ( assert ) {
4951 assert . equal ( tokenizeAndDescribe ( 'hello fruit:' ) , 'hello(space) (space)fruit:(field)' ) ;
5052 } ) ;
5153
52- it ( 'identifies symbol-modifiers' , function ( ) {
54+ test ( 'identifies symbol-modifiers' , function ( assert ) {
5355 assert . equal ( tokenizeAndDescribe ( '#fruits' ) , '#fruits(symbol)' ) ;
5456 } ) ;
5557
56- it ( 'treats completed modifiers as a single token' , function ( ) {
58+ test ( 'treats completed modifiers as a single token' , function ( assert ) {
5759 assert . equal ( tokenizeAndDescribe ( 'hello fruit:apple' ) , 'hello(space) (space)fruit:apple(field)' ) ;
5860 } ) ;
5961
60- it ( 'permits spaces between a field-modifier and its value' , function ( ) {
62+ test ( 'permits spaces between a field-modifier and its value' , function ( assert ) {
6163 assert . equal ( tokenizeAndDescribe ( 'hello fruit: apple' ) , 'hello(space) (space)fruit: apple(field)' ) ;
6264 } ) ;
6365
64- it ( 'does not permit spaces between a symbol-modifier and its value' , function ( ) {
66+ test ( 'does not permit spaces between a symbol-modifier and its value' , function ( assert ) {
6567 assert . equal ( tokenizeAndDescribe ( '# fruits' ) , '#(symbol) (space)fruits(space)' ) ;
6668 } ) ;
6769
68- it ( 'accepts quoted phrases as values for modifiers' , function ( ) {
70+ test ( 'accepts quoted phrases as values for modifiers' , function ( assert ) {
6971 assert . equal ( tokenizeAndDescribe ( 'fruit: "apple"' ) , 'fruit: "apple"(field)' ) ;
7072 } ) ;
7173
72- it ( 'treats space after text after modifiers as a token break' , function ( ) {
74+ test ( 'treats space after text after modifiers as a token break' , function ( assert ) {
7375 assert . equal ( tokenizeAndDescribe ( 'fruit: apple hello' ) , 'fruit: apple(field) (space)hello(space)' ) ;
7476 } ) ;
7577
76- it ( 'treats broken modifiers as a single token' , function ( ) {
78+ test ( 'treats broken modifiers as a single token' , function ( assert ) {
7779 assert . equal ( tokenizeAndDescribe ( 'hello fruit:grape' ) , 'hello(space) (space)fruit:grape(field)' ) ;
7880 } ) ;
7981 } ) ;
0 commit comments