Skip to content

Commit

Permalink
Fix test for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
korsvanloon committed Oct 5, 2022
1 parent 606cce8 commit 2c2393d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

This repository contains 2 plugins for Graphql codegen to generate Amplience JSON schemas and Terraform resources for Amplience Content Types out of a Graphql schema.


## AmplienceJSON plugin

For more details see the [JSON plugin folder](/packages/plugin-json)
Expand All @@ -21,3 +20,13 @@ Assuming you have yarn installed with node 16, run:
yarn
yarn start
```

# Publish

Go to Github, click on release and give it a version number higher than the ones you can currently find in the package.json, prepended with a `v`.

For instance if `packages/common/package.json` reads `"version": "0.1.8",`, you can enter `v0.1.9`.
This will create a new npm release for all 3 packages with that name as the git tag and release name.

Note that these versions are the same among all three packages.
The version in the `package.json`s is managed by Lerna and automatically updated after you've create a release in Github.
2 changes: 1 addition & 1 deletion packages/plugin-json/test/generator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { addToSchema } from '../src/index'
import { contentTypeSchemaBody } from '../src/lib/amplience-schema-transformers'

it.each([{ graphqlFile: 'base', jsons: ['a', 'b', 'base', 'localized'] }])(
'correct JSON files for $graphql',
'correct JSON files for $graphqlFile',
({ graphqlFile, jsons }) => {
const schema = buildSchema(
addToSchema +
Expand Down
10 changes: 6 additions & 4 deletions packages/plugin-terraform/test/generator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { buildSchema } from 'graphql'
import { addToSchema, plugin } from '../src/index'

it.each([{ graphqlFile: 'base' }])(
'correct JSON files for $graphql',
({ graphqlFile }) => {
'correct Terraform file for $graphqlFile',
async ({ graphqlFile }) => {
const schema = buildSchema(
addToSchema +
fs.readFileSync(`./test/testdata/${graphqlFile}.graphql`, 'utf8')
Expand All @@ -14,7 +14,7 @@ it.each([{ graphqlFile: 'base' }])(
'utf8'
)

const terraformResult = plugin(schema, [], {
const terraformResult = await plugin(schema, [], {
hostname: 'https://schema-examples.com',
visualization: [
{
Expand Down Expand Up @@ -52,6 +52,8 @@ it.each([{ graphqlFile: 'base' }])(
// But in this unittest we test the raw result.
// Therefore the expected output is also formatted ugly.

expect(terraformResult).toEqual(expected + '\n')
expect(terraformResult.toString().replace(/\r/g, '')).toEqual(
expected.replace(/\r/g, '') + '\n'
)
}
)

0 comments on commit 2c2393d

Please sign in to comment.