@ -25,8 +25,8 @@ const projectCreateReqBody = {
envs : {
_noco : {
db : [ dbConfig ] ,
apiClient : { data : [ ] }
}
apiClient : { data : [ ] } ,
} ,
} ,
workingEnv : '_noco' ,
meta : {
@ -37,7 +37,7 @@ const projectCreateReqBody = {
projectType : 'graphql' ,
type : 'mvc' ,
language : 'ts' ,
db : { client : 'sqlite3' , connection : { filename : 'noco.db' } }
db : { client : 'sqlite3' , connection : { filename : 'noco.db' } } ,
} ,
seedsFolder : 'seeds' ,
queriesFolder : 'queries' ,
@ -47,10 +47,10 @@ const projectCreateReqBody = {
language : 'ts' ,
apiClient : { data : [ ] } ,
auth : {
jwt : { secret : 'b8ed266d-4475-4028-8c3d-590f58bee867' , dbAlias : 'db' }
}
}
}
jwt : { secret : 'b8ed266d-4475-4028-8c3d-590f58bee867' , dbAlias : 'db' } ,
} ,
} ,
} ,
} ;
describe ( '{Auth, CRUD, HasMany, Belongs} Tests' , ( ) = > {
@ -59,7 +59,7 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
let projectId ;
// Called once before any of the tests in this block begin.
before ( function ( done ) {
before ( function ( done ) {
this . timeout ( 10000 ) ;
( async ( ) = > {
const server = express ( ) ;
@ -71,7 +71,7 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
. catch ( done ) ;
} ) ;
after ( done = > {
after ( ( done ) = > {
done ( ) ;
// process.exit();
} ) ;
@ -234,12 +234,12 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
// /**** Authentication : END ****/
/**************** START : Auth ****************/
describe ( 'Authentication' , function ( ) {
describe ( 'Authentication' , function ( ) {
this . timeout ( 10000 ) ;
const EMAIL_ID = 'abc@g.com' ;
const VALID_PASSWORD = '1234566778' ;
it ( 'Signup with valid email' , function ( done ) {
it ( 'Signup with valid email' , function ( done ) {
this . timeout ( 20000 ) ;
request ( app )
. post ( '/auth/signup' )
@ -255,18 +255,18 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
it ( 'Signup with invalid email' , done = > {
it ( 'Signup with invalid email' , ( done ) = > {
request ( app )
. post ( '/auth/signup' )
. send ( { email : 'test' , password : VALID_PASSWORD } )
. expect ( 400 , done ) ;
} ) ;
it ( 'Signin with valid credentials' , function ( done ) {
it ( 'Signin with valid credentials' , function ( done ) {
request ( app )
. post ( '/auth/signin' )
. send ( { email : EMAIL_ID , password : VALID_PASSWORD } )
. expect ( 200 , async function ( err , res ) {
. expect ( 200 , async function ( err , res ) {
if ( err ) {
return done ( err ) ;
}
@ -280,11 +280,11 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
it ( 'me' , function ( done ) {
it ( 'me' , function ( done ) {
request ( app )
. get ( '/user/me' )
. set ( 'xc-auth' , token )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) {
return done ( err ) ;
}
@ -294,7 +294,7 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
it ( 'Change password' , function ( done ) {
it ( 'Change password' , function ( done ) {
request ( app )
. post ( '/user/password/change' )
. set ( 'xc-auth' , token )
@ -302,38 +302,38 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
. expect ( 400 , done ) ;
} ) ;
it ( 'Change password - after logout' , function ( done ) {
it ( 'Change password - after logout' , function ( done ) {
// todo:
request ( app )
. post ( '/user/password/change' )
. send ( { currentPassword : 'password' , newPassword : 'password' } )
. expect ( 500 , function ( _err , _res ) {
. expect ( 500 , function ( _err , _res ) {
done ( ) ;
} ) ;
} ) ;
it ( 'Signin with invalid credentials' , function ( done ) {
it ( 'Signin with invalid credentials' , function ( done ) {
request ( app )
. post ( '/auth/signin' )
. send ( { email : 'abc@abc.com' , password : VALID_PASSWORD } )
. expect ( 400 , done ) ;
} ) ;
it ( 'Signin with invalid password' , function ( done ) {
it ( 'Signin with invalid password' , function ( done ) {
request ( app )
. post ( '/auth/signin' )
. send ( { email : EMAIL_ID , password : 'wrongPassword' } )
. expect ( 400 , done ) ;
} ) ;
it ( 'Forgot password with a non-existing email id' , function ( done ) {
it ( 'Forgot password with a non-existing email id' , function ( done ) {
request ( app )
. post ( '/auth/password/forgot' )
. send ( { email : 'abc@abc.com' } )
. expect ( 200 , done ) ;
} ) ;
it ( 'Forgot password with an existing email id' , function ( done ) {
it ( 'Forgot password with an existing email id' , function ( done ) {
this . timeout ( 10000 ) ;
request ( app )
. post ( '/auth/password/forgot' )
@ -341,14 +341,14 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
. expect ( 200 , done ) ;
} ) ;
it ( 'Email validate with an invalid token' , function ( done ) {
it ( 'Email validate with an invalid token' , function ( done ) {
request ( app )
. post ( '/auth/email/validate/someRandomValue' )
. send ( { email : EMAIL_ID } )
. expect ( 400 , done ) ;
} ) ;
it ( 'Email validate with a valid token' , function ( done ) {
it ( 'Email validate with a valid token' , function ( done ) {
console . log ( 'eeee' ) ;
// todo :
@ -360,14 +360,14 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
// .expect(500, done);
} ) ;
it ( 'Forgot password validate with an invalid token' , function ( done ) {
it ( 'Forgot password validate with an invalid token' , function ( done ) {
request ( app )
. post ( '/auth/token/validate/someRandomValue' )
. send ( { email : EMAIL_ID } )
. expect ( 400 , done ) ;
} ) ;
it ( 'Forgot password validate with a valid token' , function ( done ) {
it ( 'Forgot password validate with a valid token' , function ( done ) {
// todo
done ( ) ;
@ -378,14 +378,14 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
// .expect(500, done);
} ) ;
it ( 'Reset Password with an invalid token' , function ( done ) {
it ( 'Reset Password with an invalid token' , function ( done ) {
request ( app )
. post ( '/auth/password/reset/someRandomValue' )
. send ( { password : 'anewpassword' } )
. expect ( 400 , done ) ;
} ) ;
it ( 'Reset Password with an valid token' , function ( done ) {
it ( 'Reset Password with an valid token' , function ( done ) {
//todo
done ( ) ;
@ -396,16 +396,16 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
describe ( 'Project' , function ( ) {
describe ( 'Project' , function ( ) {
const EMAIL_ID = 'abc@g.com' ;
const VALID_PASSWORD = '1234566778' ;
before ( function ( done ) {
before ( function ( done ) {
this . timeout ( 120000 ) ;
request ( app )
. post ( '/auth/signin' )
. send ( { email : EMAIL_ID , password : VALID_PASSWORD } )
. expect ( 200 , async function ( _err , res ) {
. expect ( 200 , async function ( _err , res ) {
token = res . body . token ;
request ( app )
. post ( '/dashboard' )
@ -421,16 +421,16 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
/**** country : START ****/
describe ( 'country' , function ( ) {
describe ( 'country' , function ( ) {
/**** Query : START ****/
it ( 'countryList' , function ( done ) {
it ( 'countryList' , function ( done ) {
request ( app )
. post ( ` /nc/ ${ projectId } /v1/graphql ` )
. set ( 'xc-auth' , token )
. send ( {
query : ` { countryList(limit:5){ country_id country } } `
query : ` { countryList(limit:5){ country_id country } } ` ,
} )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) done ( err ) ;
const list = res . body . data . countryList ;
expect ( list ) . length . to . be . most ( 5 ) ;
@ -439,7 +439,7 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
it ( 'countryList - with sort' , function ( done ) {
it ( 'countryList - with sort' , function ( done ) {
// todo: order -> sort
request ( app )
@ -447,14 +447,14 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
. set ( 'xc-auth' , token )
. send ( {
query : ` { countryList(sort:"-country_id"){ country_id country } } `
query : ` { countryList(sort:"-country_id"){ country_id country } } ` ,
} )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) done ( err ) ;
const list = res . body . data . countryList ;
expect ( list [ 0 ] ) . to . have . all . keys ( [ 'country_id' , 'country' ] ) ;
expect ( list ) . satisfy ( array = > {
expect ( list ) . satisfy ( ( array ) = > {
let i = array . length ;
while ( -- i ) {
if ( array [ i ] . country_id > array [ i - 1 ] . country_id ) return false ;
@ -466,15 +466,15 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
it ( 'countryList - with limit' , function ( done ) {
it ( 'countryList - with limit' , function ( done ) {
request ( app )
. post ( ` /nc/ ${ projectId } /v1/graphql ` )
. set ( 'xc-auth' , token )
. send ( {
query : ` { countryList(limit:6){ country_id country } } `
query : ` { countryList(limit:6){ country_id country } } ` ,
} )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) done ( err ) ;
const list = res . body . data . countryList ;
expect ( list [ 0 ] ) . to . have . all . keys ( [ 'country_id' , 'country' ] ) ;
@ -483,15 +483,15 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
it ( 'countryList - with offset' , function ( done ) {
it ( 'countryList - with offset' , function ( done ) {
request ( app )
. post ( ` /nc/ ${ projectId } /v1/graphql ` )
. set ( 'xc-auth' , token )
. send ( {
query : ` { countryList(offset:0,limit:6){ country_id country } } `
query : ` { countryList(offset:0,limit:6){ country_id country } } ` ,
} )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) done ( err ) ;
const list1 = res . body . data . countryList ;
expect ( list1 [ 0 ] ) . to . have . all . keys ( [ 'country_id' , 'country' ] ) ;
@ -500,14 +500,14 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
. set ( 'xc-auth' , token )
. send ( {
query : ` { countryList(offset:1,limit:5){ country_id country } } `
query : ` { countryList(offset:1,limit:5){ country_id country } } ` ,
} )
. expect ( 200 , function ( err , res1 ) {
. expect ( 200 , function ( err , res1 ) {
if ( err ) done ( err ) ;
const list2 = res1 . body . data . countryList ;
expect ( list2 [ 0 ] ) . to . have . all . keys ( [ 'country_id' , 'country' ] ) ;
expect ( list2 ) . satisfy (
arr = >
( arr ) = >
arr . every (
( { country , country_id } , i ) = >
country === list1 [ i + 1 ] . country &&
@ -521,21 +521,21 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
it ( 'countryList - nested count' , function ( done ) {
it ( 'countryList - nested count' , function ( done ) {
request ( app )
. post ( ` /nc/ ${ projectId } /v1/graphql ` )
. set ( 'xc-auth' , token )
. send ( {
query : ` { countryList{ country_id country cityCount} } `
query : ` { countryList{ country_id country cityCount} } ` ,
} )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) done ( err ) ;
const list = res . body . data . countryList ;
expect ( list [ 0 ] ) . to . have . all . keys ( [
'country_id' ,
'country' ,
'cityCount'
'cityCount' ,
] ) ;
expect ( list [ 0 ] . cityCount ) . to . be . a ( 'number' ) ;
expect ( list [ 0 ] . cityCount % 1 ) . to . be . equal ( 0 ) ;
@ -543,28 +543,28 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
it ( 'countryList - nested cityList' , function ( done ) {
it ( 'countryList - nested cityList' , function ( done ) {
request ( app )
. post ( ` /nc/ ${ projectId } /v1/graphql ` )
. set ( 'xc-auth' , token )
. send ( {
query : ` { countryList{ country_id country cityList { city country_id }} } `
query : ` { countryList{ country_id country cityList { city country_id }} } ` ,
} )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) done ( err ) ;
const list = res . body . data . countryList ;
expect ( list [ 0 ] ) . to . have . all . keys ( [
'country_id' ,
'country' ,
'cityList'
'cityList' ,
] ) ;
expect ( list [ 0 ] . cityList ) . to . be . a ( 'Array' ) ;
if ( dbConfig . client !== 'mssql' ) {
expect ( list [ 0 ] . cityList [ 0 ] ) . to . be . a ( 'object' ) ;
expect ( list [ 0 ] . cityList [ 0 ] ) . to . have . all . keys ( [
'country_id' ,
'city'
'city' ,
] ) ;
expect ( Object . keys ( list [ 0 ] . cityList [ 0 ] ) ) . to . have . length ( 2 ) ;
expect ( list [ 0 ] . cityList [ 0 ] . country_id ) . to . be . equal (
@ -575,15 +575,15 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
it ( 'countryRead' , function ( done ) {
it ( 'countryRead' , function ( done ) {
request ( app )
. post ( ` /nc/ ${ projectId } /v1/graphql ` )
. set ( 'xc-auth' , token )
. send ( {
query : ` { countryRead(id: "1"){ country_id country } } `
query : ` { countryRead(id: "1"){ country_id country } } ` ,
} )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) done ( err ) ;
const data = res . body . data . countryRead ;
expect ( data ) . to . be . a ( 'object' ) ;
@ -593,15 +593,15 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
it ( 'countryExists' , function ( done ) {
it ( 'countryExists' , function ( done ) {
request ( app )
. post ( ` /nc/ ${ projectId } /v1/graphql ` )
. set ( 'xc-auth' , token )
. send ( {
query : ` { countryExists(id: "1") } `
query : ` { countryExists(id: "1") } ` ,
} )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) done ( err ) ;
const data = res . body . data . countryExists ;
expect ( data ) . to . be . a ( 'boolean' ) ;
@ -610,15 +610,15 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
it ( 'countryExists - with non-existing id' , function ( done ) {
it ( 'countryExists - with non-existing id' , function ( done ) {
request ( app )
. post ( ` /nc/ ${ projectId } /v1/graphql ` )
. set ( 'xc-auth' , token )
. send ( {
query : ` { countryExists(id: "30000") } `
query : ` { countryExists(id: "30000") } ` ,
} )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) done ( err ) ;
const data = res . body . data . countryExists ;
expect ( data ) . to . be . a ( 'boolean' ) ;
@ -627,15 +627,15 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
it ( 'countryFindOne' , function ( done ) {
it ( 'countryFindOne' , function ( done ) {
request ( app )
. post ( ` /nc/ ${ projectId } /v1/graphql ` )
. set ( 'xc-auth' , token )
. send ( {
query : ` { countryFindOne (where: "(country_id,eq,1)"){ country country_id } } `
query : ` { countryFindOne (where: "(country_id,eq,1)"){ country country_id } } ` ,
} )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) done ( err ) ;
const data = res . body . data . countryFindOne ;
expect ( data ) . to . be . a ( 'object' ) ;
@ -645,15 +645,15 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
it ( 'countryCount - filter by id' , function ( done ) {
it ( 'countryCount - filter by id' , function ( done ) {
request ( app )
. post ( ` /nc/ ${ projectId } /v1/graphql ` )
. set ( 'xc-auth' , token )
. send ( {
query : ` { countryCount (where: "(country_id,eq,1)") } `
query : ` { countryCount (where: "(country_id,eq,1)") } ` ,
} )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) done ( err ) ;
const data = res . body . data . countryCount ;
expect ( data ) . to . be . a ( 'number' ) ;
@ -662,15 +662,15 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
it ( 'countryDistinct' , function ( done ) {
it ( 'countryDistinct' , function ( done ) {
request ( app )
. post ( ` /nc/ ${ projectId } /v1/graphql ` )
. set ( 'xc-auth' , token )
. send ( {
query : ` { countryDistinct(column_name: "last_update") { last_update } } `
query : ` { countryDistinct(column_name: "last_update") { last_update } } ` ,
} )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) done ( err ) ;
const data = res . body . data . countryDistinct ;
expect ( data ) . to . be . a ( 'array' ) ;
@ -682,15 +682,15 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
if ( dbConfig . client !== 'mssql' ) {
it ( 'countryGroupBy' , function ( done ) {
it ( 'countryGroupBy' , function ( done ) {
request ( app )
. post ( ` /nc/ ${ projectId } /v1/graphql ` )
. set ( 'xc-auth' , token )
. send ( {
query : ` { countryGroupBy(fields: "last_update",limit:5) { last_update count } } `
query : ` { countryGroupBy(fields: "last_update",limit:5) { last_update count } } ` ,
} )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) done ( err ) ;
const data = res . body . data . countryGroupBy ;
expect ( data . length ) . to . be . most ( 5 ) ;
@ -701,15 +701,15 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
it ( 'countryGroupBy - Multiple' , function ( done ) {
it ( 'countryGroupBy - Multiple' , function ( done ) {
request ( app )
. post ( ` /nc/ ${ projectId } /v1/graphql ` )
. set ( 'xc-auth' , token )
. send ( {
query : ` { countryGroupBy(fields: "last_update,country",limit:5) { last_update country count } } `
query : ` { countryGroupBy(fields: "last_update,country",limit:5) { last_update country count } } ` ,
} )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) done ( err ) ;
const data = res . body . data . countryGroupBy ;
expect ( data . length ) . to . be . most ( 5 ) ;
@ -721,15 +721,15 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
it ( 'countryAggregate' , function ( done ) {
it ( 'countryAggregate' , function ( done ) {
request ( app )
. post ( ` /nc/ ${ projectId } /v1/graphql ` )
. set ( 'xc-auth' , token )
. send ( {
query : ` { countryAggregate(func: "sum,avg,min,max,count", column_name : "country_id") { sum avg min max count } } `
query : ` { countryAggregate(func: "sum,avg,min,max,count", column_name : "country_id") { sum avg min max count } } ` ,
} )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) done ( err ) ;
const data = res . body . data . countryAggregate ;
expect ( data ) . to . be . a ( 'array' ) ;
@ -741,7 +741,7 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
expect ( data [ 0 ] . count )
. to . be . a ( 'number' )
. and . satisfy (
num = > num === parseInt ( num ) ,
( num ) = > num === parseInt ( num ) ,
'count should be an integer'
) ;
expect ( Object . keys ( data [ 0 ] ) . length ) . to . be . equal ( 5 ) ;
@ -750,21 +750,21 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
it ( 'countryDistribution' , function ( done ) {
it ( 'countryDistribution' , function ( done ) {
request ( app )
. post ( ` /nc/ ${ projectId } /v1/graphql ` )
. set ( 'xc-auth' , token )
. send ( {
query : ` { countryDistribution(column_name : "country_id") { range count } } `
query : ` { countryDistribution(column_name : "country_id") { range count } } ` ,
} )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) done ( err ) ;
const data = res . body . data . countryDistribution ;
expect ( data ) . to . be . a ( 'array' ) ;
expect ( data [ 0 ] . count ) . to . be . a ( 'number' ) ;
expect ( data [ 0 ] . count ) . satisfies (
num = > num === parseInt ( num ) && num >= 0 ,
( num ) = > num === parseInt ( num ) && num >= 0 ,
'should be a positive integer'
) ;
expect ( data [ 0 ] . range ) . to . be . a ( 'string' ) ;
@ -779,12 +779,12 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
/**** Query : END ****/
/**** Mutation : START ****/
describe ( 'Mutation' , function ( ) {
describe ( 'Mutation' , function ( ) {
const COUNTRY_ID = 9999 ;
// const COUNTRY_CREATE_ID = 9998;
// const COUNTRY_NAME = 'test-name';
before ( function ( done ) {
before ( function ( done ) {
// create table entry for update and delete
// let db = knex(config.envs.dev.db[0])('country');
// db.insert({
@ -794,7 +794,7 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
done ( ) ;
} ) ;
after ( function ( done ) {
after ( function ( done ) {
// delete table entries which is created for the test
// let db = knex(config.envs.dev.db[0])('country');
// db.whereIn('country_id', [COUNTRY_ID, COUNTRY_CREATE_ID])
@ -803,16 +803,16 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
done ( ) ;
} ) ;
it ( 'countryCreate' , function ( done ) {
it ( 'countryCreate' , function ( done ) {
request ( app )
. post ( ` /nc/ ${ projectId } /v1/graphql ` )
. set ( 'xc-auth' , token )
. send ( {
query : ` mutation{ countryCreate( data : { country: "abcd" ${
dbConfig . client === 'sqlite3' ? ' country_id : 999 ' : ''
} } ) { country_id country } } `
} } ) { country_id country } } ` ,
} )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) done ( err ) ;
const data = res . body . data . countryCreate ;
expect ( data ) . to . be . a ( 'object' ) ;
@ -822,15 +822,15 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
it ( 'countryUpdate' , function ( done ) {
it ( 'countryUpdate' , function ( done ) {
request ( app )
. post ( ` /nc/ ${ projectId } /v1/graphql ` )
. set ( 'xc-auth' , token )
. send ( {
query : ` mutation{ countryUpdate( id : " ${ COUNTRY_ID } ", data : { country: "abcd" }){ country } } `
query : ` mutation{ countryUpdate( id : " ${ COUNTRY_ID } ", data : { country: "abcd" }){ country } } ` ,
} )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) done ( err ) ;
const data = res . body . data . countryUpdate ;
expect ( data ) . to . be . a ( 'object' ) ;
@ -839,15 +839,15 @@ describe('{Auth, CRUD, HasMany, Belongs} Tests', () => {
} ) ;
} ) ;
it ( 'countryDelete' , function ( done ) {
it ( 'countryDelete' , function ( done ) {
request ( app )
. post ( ` /nc/ ${ projectId } /v1/graphql ` )
. set ( 'xc-auth' , token )
. send ( {
query : ` mutation{ countryDelete( id : " ${ COUNTRY_ID } ") } `
query : ` mutation{ countryDelete( id : " ${ COUNTRY_ID } ") } ` ,
} )
. expect ( 200 , function ( err , res ) {
. expect ( 200 , function ( err , res ) {
if ( err ) done ( err ) ;
const data = res . body . data . countryDelete ;
expect ( data ) . to . be . a ( 'number' ) ;