Skip to content

Commit

Permalink
update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mschuchard committed Apr 26, 2024
1 parent 5bc28ce commit 231536a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions spec/fixtures/clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
hosts: whatever

tasks:
- name: Hello world
ansible.builtin.debug:
msg: 'Hello!'
- name: Hello world
ansible.builtin.debug:
msg: 'Hello!'
4 changes: 2 additions & 2 deletions spec/fixtures/include_has_issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
- name: Include has issues
hosts: whatever
tasks:
- name: Include with issues
ansible.builtin.include_tasks: include_with_issues.yml
- name: Include with issues
ansible.builtin.include_tasks: include_with_issues.yml
20 changes: 10 additions & 10 deletions spec/linter-ansible-linting-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('The Ansible Lint provider for Linter', () => {
it('finds all the messages', () => {
waitsForPromise(() =>
lint(editor).then(messages => {
expect(messages.length).toEqual(12);
expect(messages.length).toEqual(29);
})
);
});
Expand Down Expand Up @@ -155,7 +155,7 @@ describe('The Ansible Lint provider for Linter', () => {
expect(messages[0].location.file).toBeDefined();
expect(messages[0].location.file).toMatch(/.+syntax\.yml$/);
expect(messages[0].location.position).toBeDefined();
expect(messages[0].location.position).toEqual([[5, 6], [5, 7]]);
expect(messages[0].location.position).toEqual([[5, 4], [5, 5]]);
});
});
});
Expand Down Expand Up @@ -186,7 +186,7 @@ describe('The Ansible Lint provider for Linter', () => {
expect(messages[0].severity).toBeDefined();
expect(messages[0].severity).toEqual('error');
expect(messages[0].excerpt).toBeDefined();
expect(messages[0].excerpt).toEqual('Ansible syntax check failed for unknown reason; use syntax checker for more information.');
expect(messages[0].excerpt).toEqual('load-failure[runtimeerror]: Failed to load YAML file: yaml_syntax.yml');
expect(messages[0].location.file).toBeDefined();
expect(messages[0].location.file).toMatch(/.+yaml_syntax\.yml$/);
expect(messages[0].location.position).toBeDefined();
Expand Down Expand Up @@ -221,7 +221,7 @@ describe('The Ansible Lint provider for Linter', () => {
expect(messages[0].severity).toBeDefined();
expect(messages[0].severity).toEqual('warning');
expect(messages[0].excerpt).toBeDefined();
expect(messages[0].excerpt).toEqual("foo:1: load-failure [Errno 2] No such file or directory: 'foo' (filenotfounderror)");
expect(messages[0].excerpt).toMatch(/foo:1: load-failure\[filenotfounderror\]: \[Errno 2\] No such file or directory: '.+spec\/fixtures\/foo'/);
expect(messages[0].location.file).toBeDefined();
expect(messages[0].location.file).toMatch(/.+missing_include\.yml$/);
expect(messages[0].location.position).toBeDefined();
Expand Down Expand Up @@ -329,23 +329,23 @@ describe('The Ansible Lint provider for Linter', () => {
expect(messages[0].severity).toBeDefined();
expect(messages[0].severity).toEqual('warning');
expect(messages[0].excerpt).toBeDefined();
expect(messages[0].excerpt).toEqual('yaml: too many blank lines (7 > 2) (empty-lines)');
expect(messages[0].excerpt).toEqual('yaml[empty-lines]: Too many blank lines (7 > 2)');
expect(messages[1].location.file).toBeDefined();
expect(messages[1].location.file).toMatch(/.+include_with_issues\.yml$/);
expect(messages[1].location.position).toBeDefined();
expect(messages[1].location.position).toEqual([[9, 0], [9, 1]]);
expect(messages[1].severity).toBeDefined();
expect(messages[1].severity).toEqual('warning');
expect(messages[1].excerpt).toBeDefined();
expect(messages[1].excerpt).toEqual('fqcn-builtins: Use FQCN for builtin actions.');
expect(messages[1].excerpt).toEqual('fqcn[action-core]: Use FQCN for builtin module actions (command).');
expect(messages[2].location.file).toBeDefined();
expect(messages[2].location.file).toMatch(/.+include_with_issues\.yml$/);
expect(messages[2].location.position).toBeDefined();
expect(messages[2].location.position).toEqual([[9, 0], [9, 1]]);
expect(messages[2].severity).toBeDefined();
expect(messages[2].severity).toEqual('warning');
expect(messages[2].excerpt).toBeDefined();
expect(messages[2].excerpt).toEqual('inline-env-var: Command module does not accept setting environment variables inline');
expect(messages[2].excerpt).toEqual('inline-env-var: Command module does not accept setting environment variables inline.');
});
});
});
Expand Down Expand Up @@ -387,11 +387,11 @@ describe('The Ansible Lint provider for Linter', () => {
expect(messages[0].location.file).toBeDefined();
expect(messages[0].location.file).toMatch(/.+include_with_issues\.yml$/);
expect(messages[0].location.position).toBeDefined();
expect(messages[0].location.position).toEqual([[9, 2], [9, 3]]);
expect(messages[0].location.position).toEqual([[8, 0], [8, 1]]);
expect(messages[0].severity).toBeDefined();
expect(messages[0].severity).toEqual('error');
expect(messages[0].severity).toEqual('warning');
expect(messages[0].excerpt).toBeDefined();
expect(messages[0].excerpt).toEqual("syntax-check: 'command' is not a valid attribute for a Play");
expect(messages[0].excerpt).toEqual('yaml[empty-lines]: Too many blank lines (7 > 2)');
});
});
});
Expand Down

0 comments on commit 231536a

Please sign in to comment.