#!/usr/bin/env babel-node

/* eslint-disable no-console */

import path from 'path'
import fs from 'fs'
import {executeQuery, cypher} from '../src/graphql/db'

const fixturesFile = path.join(__dirname, '..', 'db', 'fixtures.cypher')

async function main() {
  try {
    const fixtures = fs.readFileSync(fixturesFile).toString()

    await executeQuery(cypher`
      MATCH (n)
      OPTIONAL MATCH ()-[e]-()
      DELETE n, e
    `)

    await executeQuery({
      query: fixtures
    })

  } catch (err) {
    console.log(err.stack)
  }
}

main()

@@ -320,17 +320,30 @@
 String()
+.split(/;%5Cn/)
 %0A
-
 %0A    awa
@@ -439,16 +439,56 @@
     %60)%0A%0A
+    for (const fixture of fixtures) %7B%0A  
     awai
@@ -510,16 +510,18 @@
 %7B%0A      
+  
 query: f
@@ -530,16 +530,23 @@
 ture
-s
 %0A
+  
     %7D)
+%0A    %7D
 %0A%0A  

Split fixtures by semicolon