mercredi 29 avril 2015

In JavaScript Unit Testing, test same kind of data but get different result

this is my project directory :

QQ20150430-1@2x.png

i'm making a projcet for fetch info from website and write into file as json

when i use 'fs-extra' module to check the content of file , i get different result:

QQ20150430-2@2x.png

it's pretty weird , if i am got a wrong path for check file's content , those three unit testing case must fail together , but the first one pass !

unit testing log:

QQ20150430-3@2x.png

i use an object to config the path :

var config = {
    promiseData:    '../data/promiseData.json',
    asyncData:      '../data/asyncData.json',
    eventproxyData: '../data/eventproxyData.json'
}

and the data file all in the same directory , why the unit testing case only pass the first one ??

and then i try to use the readJson() and readJsonSync(), the result as before , only the first pass .

there are three same content in the file

and i'm confused and please help me , thanks a lot ~

the project address: callback

Aucun commentaire:

Enregistrer un commentaire