graphql-engine/cli-ext/tests/sdl/test.js
Aravind Shankar bb63d7e60e
cli: allow managing actions (#3859)
Co-authored-by: Rishichandra Wawhal <rishichandra.wawhal@gmail.com>
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
Co-authored-by: Aravind <aravindkp@outlook.in>
Co-authored-by: Anon Ray <ecthiender@users.noreply.github.com>
Co-authored-by: Shahidh K Muhammed <muhammedshahid.k@gmail.com>
2020-02-24 21:44:46 +05:30

36 lines
884 B
JavaScript

const { toPayload, fromPayload } = require('./payload');
const { handlePayload: toHandler } = require('../../build/services/sdl/to/handler');
const { handlePayload: fromHandler } = require('../../build/services/sdl/from/handler');
const test = async () => {
const toResponse = toHandler(toPayload);
if (
toResponse.status === 200
) {
console.log('✓ Conversion from metadata to SDL passed');
} else {
console.log('✘ Conversion from metadata to SDL failed');
console.log(toResponse);
process.exit(1);
}
const fromResponse = fromHandler(fromPayload);
if (
fromResponse.status === 200
) {
console.log('✓ Conversion from SDL to metadata passed');
} else {
console.log('✘ Conversion from SDL to metadata failed');
console.log(fromResponse);
process.exit(1);
}
return Promise.resolve()
}
module.exports = test;