11import * as dgraph from "../src" ;
2- import { strToU8 , u8ToStr } from "../src/util" ;
32
43import { setSchema , setup } from "./helper" ;
54
@@ -18,7 +17,7 @@ describe("txn", () => {
1817
1918 const mu = new dgraph . Mutation ( ) ;
2019 mu . setCommitNow ( true ) ;
21- mu . setSetNquads ( strToU8 ( '_:alice <name> "Alice" .' ) ) ;
20+ mu . setSetNquads ( '_:alice <name> "Alice" .' ) ;
2221 await client . newTxn ( ) . mutate ( mu ) ;
2322 } ) ;
2423
@@ -31,7 +30,7 @@ describe("txn", () => {
3130 ) ;
3231 let resJson : {
3332 me : { name : string } [ ] ;
34- } = JSON . parse ( u8ToStr ( res . getJson_asU8 ( ) ) ) ; // tslint:disable-line no-unsafe-any
33+ } = res . getJson ( ) ; // tslint:disable-line no-unsafe-any
3534 expect ( resJson . me ) . toHaveLength ( 1 ) ;
3635 expect ( resJson . me [ 0 ] . name ) . toEqual ( "Alice" ) ;
3736
@@ -42,7 +41,7 @@ describe("txn", () => {
4241 $b : true , // non-string properties are ignored
4342 } ,
4443 ) ;
45- resJson = JSON . parse ( u8ToStr ( res . getJson_asU8 ( ) ) ) ; // tslint:disable-line no-unsafe-any
44+ resJson = res . getJson ( ) ; // tslint:disable-line no-unsafe-any
4645 expect ( resJson . me ) . toHaveLength ( 1 ) ;
4746 expect ( resJson . me [ 0 ] . name ) . toEqual ( "Alice" ) ;
4847 } ) ;
@@ -56,7 +55,7 @@ describe("txn", () => {
5655 ) ;
5756 const resJson : {
5857 me : { name : string } [ ] ;
59- } = JSON . parse ( u8ToStr ( res . getJson_asU8 ( ) ) ) ; // tslint:disable-line no-unsafe-any
58+ } = res . getJson ( ) ; // tslint:disable-line no-unsafe-any
6059 expect ( resJson . me ) . toHaveLength ( 0 ) ;
6160 } ) ;
6261
@@ -83,7 +82,7 @@ describe("txn", () => {
8382 await txn . commit ( ) ;
8483
8584 const mu = new dgraph . Mutation ( ) ;
86- mu . setSetNquads ( strToU8 ( '_:alice <name> "Alice" .' ) ) ;
85+ mu . setSetNquads ( '_:alice <name> "Alice" .' ) ;
8786 const p = txn . mutate ( mu ) ;
8887 await expect ( p ) . rejects . toBe ( dgraph . ERR_FINISHED ) ;
8988 } ) ;
@@ -93,7 +92,7 @@ describe("txn", () => {
9392
9493 const mu = new dgraph . Mutation ( ) ;
9594 // There is an error in the mutation NQuad.
96- mu . setSetNquads ( strToU8 ( 'alice <name> "Alice" .' ) ) ;
95+ mu . setSetNquads ( 'alice <name> "Alice" .' ) ;
9796 const p1 = txn . mutate ( mu ) ;
9897 await expect ( p1 ) . rejects . toBeDefined ( ) ;
9998
@@ -120,7 +119,7 @@ describe("txn", () => {
120119 const txn = client . newTxn ( ) ;
121120
122121 const mu = new dgraph . Mutation ( ) ;
123- mu . setSetNquads ( strToU8 ( '_:alice <name> "Alice" .' ) ) ;
122+ mu . setSetNquads ( '_:alice <name> "Alice" .' ) ;
124123 mu . setCommitNow ( true ) ;
125124 await txn . mutate ( mu ) ;
126125
@@ -147,7 +146,7 @@ describe("txn", () => {
147146 const txn = client . newTxn ( ) ;
148147
149148 const mu = new dgraph . Mutation ( ) ;
150- mu . setSetNquads ( strToU8 ( '_:alice <name> "Alice" .' ) ) ;
149+ mu . setSetNquads ( '_:alice <name> "Alice" .' ) ;
151150 mu . setCommitNow ( true ) ;
152151 await txn . mutate ( mu ) ;
153152
0 commit comments