source_gen_test icon indicating copy to clipboard operation
source_gen_test copied to clipboard

How can I test ignore the format of generate code and actual code?

Open johntyty912 opened this issue 2 years ago • 0 comments

Here's the test case:

@ShouldGenerate(
  '''class shouldHaveTheCorrectAddressAndPathImpl implements shouldHaveTheCorrectAddressAndPath {
  Socket socket = io('https://api.robocore.ai', {
        'path': '/remote',
        'transports': ['websocket'],
        'forceNew': true,
      });
  }''',
  contains: true,
  expectedLogItems: [
    'onEventElements: 0',
    'emitEventElements: 0',
    'eventListenersElements: 0',
  ],
)
@SocketIoClient(address: "https://api.robocore.ai", path: "/remote")
class shouldHaveTheCorrectAddressAndPath {}

And It can't pass:

Expected: contains 'class shouldHaveTheCorrectAddressAndPathImpl implements shouldHaveTheCorrectAddressAndPath {\n'
            '  Socket socket = io(\'https://api.robocore.ai\', {\n'
            '        \'path\': \'/remote\',\n'
            '        \'transports\': [\'websocket\'],\n'
            '        \'forceNew\': true,\n'
            '      });\n'
            '  }'
  Actual: 'class shouldHaveTheCorrectAddressAndPathImpl\n'
            '    implements shouldHaveTheCorrectAddressAndPath {\n'
            '  Socket socket = io(\'https://api.robocore.ai\', {\n'
            '    \'path\': \'/remote\',\n'
            '    \'transports\': [\'websocket\'],\n'
            '    \'forceNew\': true,\n'
            '  });\n'
            '}\n'
            ''

The actual one is almosts the same with the expected, I want to know how to just ignore the format??? Thanks

johntyty912 avatar Aug 19 '22 09:08 johntyty912