UNPKG

862 BJavaScriptView Raw
1const assert = require('assert')
2const linter = require('./../../../lib/index')
3
4describe('Linter - comprehensive-interface', () => {
5 it('should raise an error', () => {
6 const code = require('../../fixtures/miscellaneous/public-function-no-override')
7
8 const report = linter.processStr(code, {
9 rules: { 'comprehensive-interface': 'error' }
10 })
11
12 assert.equal(report.errorCount, 1)
13 assert.ok(
14 report.messages[0].message.includes(
15 'All public or external methods in a contract must override a definition from an interface'
16 )
17 )
18 })
19
20 it('should not raise an error', () => {
21 const code = require('../../fixtures/miscellaneous/public-function-with-override')
22
23 const report = linter.processStr(code, {
24 rules: { 'comprehensive-interface': 'error' }
25 })
26
27 assert.equal(report.errorCount, 0)
28 })
29})