Skip to content

Commit

Permalink
Fix EC violations (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
szepeviktor authored Dec 19, 2023
1 parent babf95a commit 16e0c43
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const source = `
>> total time: 6 minutes
>> servings: 2
Place the @apple juice{1,5%cups}, @banana{one sliced}, @frozen mixed berries{1,5%cups} and @vanilla greek yogurt{3/4%cup} in a #blender{}; blend until smooth. If the smoothie seems too thick, add a little more liquid (1/4 cup).
Place the @apple juice{1,5%cups}, @banana{one sliced}, @frozen mixed berries{1,5%cups} and @vanilla greek yogurt{3/4%cup} in a #blender{}; blend until smooth. If the smoothie seems too thick, add a little more liquid (1/4 cup).
Taste and add @honey{} if desired. Pour into two glasses and garnish with fresh berries and mint sprigs if desired.
`;
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build
- run: npm test
- run: npm test
56 changes: 28 additions & 28 deletions assets/logo_white_bg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
/**
* @type {import('ts-jest/dist/types').InitialOptionsTsJest}
*/
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
preset: 'ts-jest',
testEnvironment: 'node',
};
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const source = `
>> total time: 6 minutes
>> servings: 2
Place the @apple juice{1,5%cups}, @banana{one sliced}, @frozen mixed berries{1,5%cups} and @vanilla greek yogurt{3/4%cup} in a #blender{}; blend until smooth. If the smoothie seems too thick, add a little more liquid (1/4 cup).
Place the @apple juice{1,5%cups}, @banana{one sliced}, @frozen mixed berries{1,5%cups} and @vanilla greek yogurt{3/4%cup} in a #blender{}; blend until smooth. If the smoothie seems too thick, add a little more liquid (1/4 cup).
Taste and add @honey{} if desired. Pour into two glasses and garnish with fresh berries and mint sprigs if desired.
`;
Expand Down
42 changes: 21 additions & 21 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@ const testsPath = "./tests";
const testFiles = fs.readdirSync(testsPath).filter((f) => f.endsWith(".yaml"));

testFiles.forEach((testFile) => {
const testYaml = fs.readFileSync(`${testsPath}/${testFile}`, "utf-8");
const testData = yaml.parse(testYaml).tests as Record<
string,
{ source: string; result: any }
>;
const testYaml = fs.readFileSync(`${testsPath}/${testFile}`, "utf-8");
const testData = yaml.parse(testYaml).tests as Record<
string,
{ source: string; result: any }
>;

describe(testFile, () => {
Object.entries(testData).forEach(([name, testEntry]) => {
it(name, () => {
const { source, result } = testEntry;
const parsed = parser.parse(source);
describe(testFile, () => {
Object.entries(testData).forEach(([name, testEntry]) => {
it(name, () => {
const { source, result } = testEntry;
const parsed = parser.parse(source);

const expected = {
steps: result.steps,
metadata: Array.isArray(result.metadata) ? {} : result.metadata,
};
const expected = {
steps: result.steps,
metadata: Array.isArray(result.metadata) ? {} : result.metadata,
};

const actual = {
steps: parsed.steps,
metadata: parsed.metadata,
};
const actual = {
steps: parsed.steps,
metadata: parsed.metadata,
};

expect(expected).toStrictEqual(actual);
});
expect(expected).toStrictEqual(actual);
});
});
});
});
});
2 changes: 1 addition & 1 deletion tools/readme-template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ d The repository can be found [here](https://github.com/cooklang/cooklang-ts).
Tests are as found in https://github.com/cooklang/spec/blob/main/tests/canonical.yaml.
```
npm test
```
```
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@
"exclude": [
"src/example.ts"
]
}
}

0 comments on commit 16e0c43

Please sign in to comment.